ADO.Net SQL UPDATE using OleDBAdapter

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2004
Posts: 2
Reputation: sanctioned is an unknown quantity at this point 
Solved Threads: 0
sanctioned sanctioned is offline Offline
Newbie Poster

ADO.Net SQL UPDATE using OleDBAdapter

 
0
  #1
Nov 15th, 2004
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 2
Reputation: sanctioned is an unknown quantity at this point 
Solved Threads: 0
sanctioned sanctioned is offline Offline
Newbie Poster

Re: ADO.Net SQL UPDATE using OleDBAdapter

 
0
  #2
Nov 21st, 2004
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC