By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

update record in access

P: n/a
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(Handle Ref hrHandle,
SQL_HANDLE hType, RETCODE retcode) at
System.Data.Odbc.OdbcCommand.ExecuteReaderObject(C ommandBehavior 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#
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Update tblName set fieldName=fieldValue where field = value

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
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(Handle Ref hrHandle,
SQL_HANDLE hType, RETCODE retcode) at
System.Data.Odbc.OdbcCommand.ExecuteReaderObject(C ommandBehavior 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#

Nov 19 '05 #2

P: n/a
"=?Utf-8?B?TWlrZQ==?=" <Mi**@discussions.microsoft.com> wrote in
news:3B**********************************@microsof t.com:
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(Handle Ref hrHandle,
SQL_HANDLE hType, RETCODE retcode) at
System.Data.Odbc.OdbcCommand.ExecuteReaderObject(C ommandBehavior
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
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.