int box1= Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
int box2= Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[1].Value);
int box3= Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[2].Value);
int box4= Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[3].Value);
int total = box1+box2+box3+box4
حالا کافیه که total رو ذخیره کنی تو دیتابس