here is my command...
try {
//Building the insert command for the addition of new records
InsertDtlsCommand.CommandText = "INSERT INTO tblGLBatch VALUES (@TransNum,
@Source, @Type, @TDate," +
"@Reference, @Code, @Note, @GSTMode, @Debit, @Credit, @GST_Debit,
@GST_Credit," +
"@Amount)" ;
//Setting the connnection object for the update command
InsertDtlsCommand.Connection = JournalConnection ;
//For each field that will be getting a value added to it, there will need
to be a parameter
//added and filled in with the appropriate information
InsertDtlsCommand.Parameters.Add("@TransNum", OleDbType.Integer, 9,
"TransNum") ;
InsertDtlsCommand.Parameters["@TransNum"].Value = GetNextTransNum() ;
InsertDtlsCommand.Parameters.Add("@Source", OleDbType.VarChar, 14, "Source")
;
InsertDtlsCommand.Parameters["@Source"].Value = "General Ledger" ;
InsertDtlsCommand.Parameters.Add("@Type", OleDbType.Integer, 9, "Type") ;
InsertDtlsCommand.Parameters["@Type"].Value = 40 ;
InsertDtlsCommand.Parameters.Add("@TDate", OleDbType.Date, 10, "TDate") ;
InsertDtlsCommand.Parameters["@TDate"].Value = txtDate.Value ;
InsertDtlsCommand.Parameters.Add("@Reference", OleDbType.VarChar, 50,
"Reference") ;
InsertDtlsCommand.Parameters["@Reference"].Value = txtReference.Text ;
InsertDtlsCommand.Parameters.Add("@Code", OleDbType.VarChar, 9, "Code") ;
InsertDtlsCommand.Parameters["@Code"].Value = txtCode.Text ;
InsertDtlsCommand.Parameters.Add("@Note", OleDbType.VarChar, 250, "Note") ;
InsertDtlsCommand.Parameters["@Note"].Value = txtNote.Text ;
InsertDtlsCommand.Parameters.Add("@GSTMode", OleDbType.VarChar, 1,
"GSTMode") ;
InsertDtlsCommand.Parameters["@GSTMode"].Value =
txtTaxCode.Text.Substring(0, 1) ;
InsertDtlsCommand.Parameters.Add("@Debit", OleDbType.Double, 10, "Debit") ;
InsertDtlsCommand.Parameters["@Debit"].Value =
Convert.ToDouble(txtDebit.Text) ;
InsertDtlsCommand.Parameters.Add("@Credit", OleDbType.Double, 10, "Credit")
;
InsertDtlsCommand.Parameters["@Credit"].Value =
Convert.ToDouble(txtCredit.Text) ;
InsertDtlsCommand.Parameters.Add("@GST_Debit", OleDbType.Double, 10,
"GST_Debit") ;
InsertDtlsCommand.Parameters["@GST_Debit"].Value =
Convert.ToDouble(txtGSTDebit.Text) ;
InsertDtlsCommand.Parameters.Add("@GST_Credit", OleDbType.Double, 10,
"GST_Credit") ;
InsertDtlsCommand.Parameters["@GST_Credit"].Value =
Convert.ToDouble(txtGSTCredit.Text) ;
InsertDtlsCommand.Parameters.Add("@Amount", OleDbType.Double , 10, "Amount")
;
InsertDtlsCommand.Parameters["@Amount"].Value = 100.00 ;
//Allocating the insert command defined above to the JournalAdapter.
JournalAdapter.InsertCommand = InsertDtlsCommand ;
}
catch(Exception e) {
MessageBox.Show(e.Message, "JournalInsertCommand", MessageBoxButtons.OK,
MessageBoxIcon.Error) ;
}
There are two more fields in the database but i don't want to update them...
if i leave them out it has a shit?? if i put tham all in it works fine??