I need help. First things first, I have datagridview which has columns(#, id, img, item_name, price, qty, discount, total), now all the columns are readonly except for qty column. What I want to happen is only the modified row will be saved to the database.
I tried
foreach (DataGridViewRow row in dataGridView1.Rows)
{
int qty = Convert.ToInt32(row.Cells["qty"].Value.ToString());
if (qty > 0)
{
con.Open();
cmd = new SqlCommand("", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@id", Convert.ToInt32(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString()));
and so on...
}
con.Close();
}
I am just a beginner in programming Thank you for your help in advance