Here is my code:
And I get an 'Syntax error in INSERT INTO statement.' error as my Exception. Can anybody tell me why?
I am trying a date that looks like 2/12/2003 in the textbox. The fields in the database are NewsID (Autonumber), Date (Date/Time), and Body (Memo).
Can't figure out what is wrong.
Code:
Dim con As New OleDb.OleDbConnection(comFunc.dbInt)
Dim com As New OleDb.OleDbCommand("INSERT INTO tblItems( Date , Body ) VALUES ( ? , ? )", con)
Dim pc As OleDb.OleDbParameterCollection = com.Parameters
pc.Add("Date", Data.OleDb.OleDbType.Date).Value = CType(Me.tbNewDate.Text, Data.OleDb.OleDbType.Date).Date
pc.Add("Body", Data.OleDb.OleDbType.LongVarWChar).Value = Me.tbBody.Text '.Value = Me.tbBody.Text
con.Open()
Try
com.ExecuteNonQuery()
Catch er As Exception
Me.errs.Text += er.ToString & "<br />"
End Try
con.Close()
And I get an 'Syntax error in INSERT INTO statement.' error as my Exception. Can anybody tell me why?
I am trying a date that looks like 2/12/2003 in the textbox. The fields in the database are NewsID (Autonumber), Date (Date/Time), and Body (Memo).
Can't figure out what is wrong.