Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i am facing the problem with this statement please say what is the error in it ,
OleDbCommand InsertCommand = new OleDbCommand("update admin set password ='"+conformpasstxt.Text+"' where username='admin'" , myOleDBConnection);



while i am executing the iam getting the error as
"Syntax error in UPDATE statement."

what is the error in it iam not able to find it
Posted

1 solution

Try:
C#
string cmdText = "UPDATE admin SET password ='"+conformpasstxt.Text+"' WHERE username='admin'";
OleDbCommand InsertCommand = new OleDbCommand(cmdText , myOleDBConnection);


Then make sure that the column 'password' in your table admin is of correct datatype.
If this doesn't work, then you need to first check if the update statement is correctly running in your SQL or not.
Try this there:
SQL
UPDATE admin SET password ='myPWD' WHERE username='admin'
 
Share this answer
 
Comments
[no name] 23-Jul-10 1:58am    
hi i had tryied that in sql also its working but not working on access , but magic is on the other table from access its working
i had deleted and add new table then also it was not working , syntax is correct but at which place is going wrong
Sandeep Mewara 23-Jul-10 2:21am    
So, your bottleneck is Access DB and not code!!!
Your first step should be to make your DB correct such that running the query in Access returns result. Once that is working, then try from code. Issue is not with code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900