我有这个表主要:
"Record ID",Status,Placement,Private,Category,Note,Description,"Due Date",Completed,Priority,Blob,"Repeat On Complete Date","Complete Date","Alarm Set","Alarm Time","Alarm Advance","Repeat Start Date","Repeat Info"
示例条目
14340973,132,2147483647,False,3,Any note,Any Description,1956556799,False,1,System.Byte[],False,1956556799,False,1956470400,0,0,
在 SQL 中插入的正确语法是什么?
这就是我所做的:
string strSQL = "INSERT INTO Main ( Record ID , Status , Placement , Private , Category , Note , Description , Due Date , Completed , Priority , Blob , Repeat On Complete Date , Complete Date , Alarm Set , Alarm Time , Alarm Advance , Repeat Start Date , Repeat Info ) VALUES (@Rid,132, 2147483647, False,, @Kat, @Not, @Bes, 1956556799, False, @Pri, '', 1956556799, False, 1956470400, 0, 0, '', '')";
MessageBox.Show(strSQL);
OleDbCommand cmd = null;
try
{
cmd = new OleDbCommand(strSQL, AufgabenVerbindung);
}
catch (Exception vvxc)
{
Console.WriteLine(vvxc.Message);
}
OleDbParameter Kat, Not, Bes, Pri, Rid;
Rid = cmd.Parameters.Add("@Rid", OleDbType.BigInt);
Kat = cmd.Parameters.Add("@Kat", OleDbType.TinyInt);
Not = cmd.Parameters.Add("@Not", OleDbType.VarChar);
Bes = cmd.Parameters.Add("@Bes", OleDbType.VarChar);
Pri = cmd.Parameters.Add("@Pri", OleDbType.TinyInt);
Rid.Value = Record_ID + 1;
Kat.Value = 5;
Not.Value = txtNotiz.Text;
Bes.Value = txtBeschreibung.Text;
Pri.Value = pri;
cmd.ExecuteNonQuery();
cmd.ExecuteNonQuery() 抛出异常
当前代码: http: //pastebin.com/16FwUhLr