954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

ADO.Net SQL UPDATE using OleDBAdapter

Hi, I am having a problem with ADO.Net and ASP.Net, I didn't post this in the ASP.Net forum because eventhough I am using ASP.Net, the problem seems to be with ADO.Net.

Anyway the code:

try
{
strSQL = "UPDATE Clients SET Password = '" + newpass + "'" +
" WHERE Email='" + User.Identity.Name + "'";;
dbCon = new OleDbConnection(strCon);
dbCon.Open();
dbAdapter = new OleDbDataAdapter();
dbCom = new OleDbCommand(strSQL,dbCon);
int x= dbCom.ExecuteNonQuery();
//...code continues

Everytime i execute this, I get an exception thrown message: "Syntax error in UPDATE statement."
I tried this same query in MS Access and it works fine (i am using an Access db).

I have no clue what the error means :sad: I don't think its the SQL statement. I thought it might be the OleDbCommand not having the capability but OleDbDataAdapter.UpdateCommand is also OleDbCommand so that can't be it.

Thanks in advance.

sanctioned
Newbie Poster
2 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

i had to put Password in brackets [], Access requires you to put reserved words in [] apparently the word Password in a SQL query was reserved in access.

sanctioned
Newbie Poster
2 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You