my function is
void counter()
{
int sum = 0;
for (int i = 0; i < dataGridView2.Rows.Count; i++)
{
sum += Convert.ToInt32(dataGridView2.Rows[i].Cells[1].Value);
}
int sum1 = 0;
for (int j = 0; j < dataGridView3.Rows.Count; j++)
{
sum1 += Convert.ToInt32(dataGridView3.Rows[j].Cells[1].Value);
}
int total = sum - sum1;
string Coonstring = "datasource=localhost;port=3306;username=root;password=***;Charset=utf8";
string cmd = "update project.material set number =total where name= '" + this.txt.Text + "';";
MySqlConnection connectionDatabase = new MySqlConnection(Coonstring);
MySqlCommand cmddata = new MySqlCommand(cmd, connectionDatabase);
MySqlDataReader myreader;
I need to update the number column with the value of ( Total). So what is the right way to do that's.
Regards