Hi all!I am a bit rusty at SQL. I am receiving a Sytax Error on an INSERT INTO statement. I am using C# in the VS2003 IDE and trying to pass parameters. Here is the statement copied directly from the debugger:INSERT INTO bonus-sales-rpt [STORE-NUM], [MODEL], [SERIAL], [COST], [INCOME], [DATESOLD], [STATUS] VALUES (@SN, @MDL, @SRL, @CST, @INC, @DS, @STA)
Here is the code in C#:command1.CommandText = "INSERT INTO bonus-sales-rpt [STORE-NUM], [MODEL], [SERIAL], [COST], [INCOME], [DATESOLD], [STATUS] " +"VALUES (@SN, @MDL, @SRL, @CST, @INC, @DS, @STA)" ;command1.Parameters.Add("@SN",OleDbType.VarChar); //text in accesscommand1.Parameters.Add("@MDL",OleDbType.VarChar);//text iu accesscommand1.Parameters.Add("@SRL",OleDbType.VarChar);//text in accesscommand1.Parameters.Add("@CST",OleDbType.Decimal);//number(decimal 8.2) in accesscommand1.Parameters.Add("@INC",OleDbType.Decimal);//number(decimal 8.2) in accesscommand1.Parameters.Add("@DS",OleDbType.DBDate);//date in accesscommand1.Parameters.Add("@STA",OleDbType.VarChar);//text in accesscommand1.Parameters["@SN"].Value = DbReader["INV-LOCATION-REC-1"].ToString();command1.Parameters["@MDL"].Value = DbReader["INV-MK-MODEL-NBR"].ToString();command1.Parameters["@SRL"].Value = DbReader["INV-MK-SERIAL-NBR"].ToString();command1.Parameters["@CST"].Value = Decimal.Parse(DbReader["INV-ORIGINAL-COST"].ToString());command1.Parameters["@INC"].Value = Decimal.Parse(DbReader["INV-RENTAL-REVENUE"].ToString());command1.Parameters["@DS"].Value = DbReader["INV-DATE-SOLD"];command1.Parameters["@STA"].Value = DbReader["INV-STATUS"].ToString();try { conn.Open(); command1.ExecuteNonQuery(); conn.Close(); }
Do you see the problem with the INSERT INTO statement?Thanx in advance!