Hi everyone, when I try and run this code, Delphi tells me I the INSERT statement has a syntax error when, as far as I can see, it doesn't.
The problem does not happen if I use:
However if I then add an autonumber field to my table in MS Access, the application throws an error saying the number of values is not the same as the number of fields.
Can anyone shed any light on this infuriating problem? Is my syntax correct?
Code:
ADOCommand1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+frm_LogIn.SpreadSheetLocation+'btbse_ScienceBookings.mdb;Persist Security Info=False';
ADOCommand1.CommandText := 'INSERT INTO tbl_Bookings (User, Period) VALUES (15, "p1")';
ADOCommand1.CommandType := cmdText;
The problem does not happen if I use:
Code:
'INSERT INTO tbl_Bookings (15, "p1")
However if I then add an autonumber field to my table in MS Access, the application throws an error saying the number of values is not the same as the number of fields.
Can anyone shed any light on this infuriating problem? Is my syntax correct?