update record in access

G

Guest

I'm trying to update an existing record in an Access 2003 db and i'm getting
the following error:

The following error has occured ERROR [42000] [Microsoft][ODBC Microsoft
Access Driver] Syntax error in UPDATE statement.
at System.Data.Odbc.OdbcConnection.HandleError(HandleRef hrHandle,
SQL_HANDLE hType, RETCODE retcode) at
System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior,
String method) at System.Data.Odbc.OdbcCommand.ExecuteNonQuery() at
TimeKeeper.Default.AddUpdateEmployee() in
c:\inetpub\wwwroot\timekeeper\default.aspx.cs:line 315

but when i write out the update query, i'm getting the value:

UPDATE car_information.carModel= 'ME ' WHERE carID=8

here is my code:
string UpdateSQL = "UPDATE car_information.empName= '" + txtCarModel.Text +
"' WHERE carID=" + carID;

any suggestions? this app is in C#
 
L

Lucas Tam

I'm trying to update an existing record in an Access 2003 db and i'm
getting the following error:

The following error has occured ERROR [42000] [Microsoft][ODBC
Microsoft Access Driver] Syntax error in UPDATE statement.
at System.Data.Odbc.OdbcConnection.HandleError(HandleRef hrHandle,
SQL_HANDLE hType, RETCODE retcode) at
System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior
behavior, String method) at
System.Data.Odbc.OdbcCommand.ExecuteNonQuery() at
TimeKeeper.Default.AddUpdateEmployee() in
c:\inetpub\wwwroot\timekeeper\default.aspx.cs:line 315

but when i write out the update query, i'm getting the value:

UPDATE car_information.carModel= 'ME ' WHERE carID=8

Your Update syntax is wrong. You forgot the SET keyword

Should be UPDATE car_information SET carModel= 'ME ' WHERE carID=8
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top