Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting error syntax error in update statement, please help and guide me.
{con.Open();
mycmd = new OleDbCommand("update empdata set Name='"+txt2.Text+"',Fname="+txt3.Text+" where Empno="+txt1.Text+"",con);
mycmd.ExecuteNonQuery();
con.Close();}

What I have tried:

I am getting error syntax error in update statement, please help and guide me.
{con.Open();
mycmd = new OleDbCommand("update empdata set Name='"+txt2.Text+"',Fname="+txt3.Text+" where Empno="+txt1.Text+"",con);
mycmd.ExecuteNonQuery();
con.Close();}
Posted

1 solution

Quote:
mycmd = new OleDbCommand("update empdata set Name='"+txt2.Text+"',Fname="+txt3.Text+" where Empno="+txt1.Text+"",con);

As a wild guess, you missed the single quotes around txt3.Text.
 
Share this answer
 
Comments
Member 12322563 13-Feb-16 2:52am    
Hi, After adding single quote same error getting. Pl help

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