I'm Having a problem in it, don't what what it is : m having a syntax error OleDbCommand com = new OleDbCommand("update cus SET cus_name = ('" + textBox4.Text + "'),order=('"+textBox6.Text+"') WHERE no = ("+textBox5.Text+")", con);

Recommended Answers

All 2 Replies

Don't put the ( and ) marks in there.

And try to use Parameters, so you dont assign values directly into the query, but in query you only write parameters, which you then add bellow.
Example:

OleDbCommand com = new OleDbCommand(@"UPDATE cus SET cus_name = @param1, order = @param2 WHERE no = @param3", con);
com.Parameters.Add("@param1", OleDbType.VarChar, 50).Value = textBox4.Text;
com.Parameters.Add("@param2", OleDbType.VarChar, 50).Value = textBox6.Text;
com.Parameters.Add("@param3", OleDbType.VarChar, 50).Value = textBox7.Text;
try
{
    com.ExecuteNonQuery();
}
catch(Excpeption ex)
{
      //show exception if needed
}

Change the type of parameters to exact type (or varchar, or int, or... - checkl your database).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.