title: how to update a table using oledb parameters?
body: <p>I am having a table which has three fields, namely LM_code,M_Name,Desc. LC_code is a autogenerated string Id, keeping this i am updating M_Name and Desc. I used normal update command, the value is passing in runtime but the fields are not getting updated. I hope using oledb parameters the fields can be updated. </p>
  
  <p>Here is my code. </p>
  
  <pre><code>public void Modify()
  {
      String query = "Update Master_Accounts set (M_Name='" + M_Name + "',Desc='" + Desc + "') where LM_code='" + LM_code + "'";
      DataManager.RunExecuteNonQuery(ConnectionString.Constr, query);
  }
  </code></pre>
  
  <p>In DataManager Class i am executing the query string.</p>
  
  <pre><code>public static void RunExecuteNonQuery(string Constr, string query)
  {
  
      OleDbConnection myConnection = new OleDbConnection(Constr);
      try
      {
          myConnection.Open();
          OleDbCommand myCommand = new OleDbCommand(query, myConnection);
          myCommand.ExecuteNonQuery();
      }
      catch (Exception ex)
      {
          string Message = ex.Message;
          throw ex;
      }
  
      finally
      {
          if (myConnection.State == ConnectionState.Open)
              myConnection.Close();
      }
  
  }
  
  private void toolstModify_Click_1(object sender, EventArgs e)
  {
      txtamcode.Enabled = true;
      jewellery.LM_code = txtamcode.Text;
      jewellery.M_Name = txtaccname.Text;
      jewellery.Desc = txtdesc.Text;
      jewellery.Modify();
      MessageBox.Show("Data Updated Succesfully");
  
  }
  </code></pre>