title: Query to update values
body: <p>I'm trying to update my database i.e. a MS Access file, I want to update my table by taking the values from the textboxes but I'm not able to write a proper query.</p>
  
  <p>Can anyone please help me to write a proper update query?</p>
  
  <pre><code>string strconn4 = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|pay.accdb";
  
  OleDbConnection sqlconn4 = new OleDbConnection(strconn4);
  sqlconn4.Open();    
  OleDbCommand ocmd = new OleDbCommand("UPDATE fees SET fname=" + Convert.ToString(textBox2.Text) + ",lname=" + Convert.ToString(textBox3.Text) + ",amtpayd=" + Convert.ToString(textBox4.Text) + ",amtleft=" + Convert.ToString(textBox5.Text) + ",disc=" + Convert.ToString(textBox6.Text) + ",pdate=" + Convert.ToString(dateTimePicker3.Text) + ",rdate=" + Convert.ToString(dateTimePicker1.Text) + ",WHERE memid=" + Convert.ToString(textBox1.Text), sqlconn4);
  </code></pre>