Characters found after end of SQL statement.
Posted on 2004-04-27
It's 3 oclock in the Am and I'm soo tired! Someone put me out of my misery.....
Here's the question - I wanted to add a Record to a table and then take the newest added record's id number for future reference. The Database is Access.
The problem is I only have the code for adding to a sql server database.
Sample Code Below:
strSql = "insert into atable(field1,field2,field3,field4) values ('value','value,'value','value');select @@IDENTITY ;"
I get this error:[Microsoft][ODBC Microsoft Access Driver] Characters found after end of SQL statement.
I have a feeling it doesn't work because Access doesn't allow multiple sql queries...
Can someone give me sample code that does the same thing for Access with code protecting me that I only get the newest id that was just entered using the insert statement