944,156 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 24777
  • C# RSS
Nov 15th, 2004
0

ADO.Net SQL UPDATE using OleDBAdapter

Expand Post »
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 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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sanctioned is offline Offline
2 posts
since Nov 2004
Nov 21st, 2004
0

Re: ADO.Net SQL UPDATE using OleDBAdapter

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sanctioned is offline Offline
2 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: If-Else in C#
Next Thread in C# Forum Timeline: Using SelectedIndexChanged to change another column on the datagrid





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC