Q = "update Table_customer set c_name ='" + TextBox4.Text.Trim() + "',c_phone='" + TextBox2.Text.Trim() + "',adress='" + TextBox3.Text.Trim() + "',number='" + TextBox1.Text.Trim() + "',date='" + DateTimePicker1.Text.Trim() + "'where id_c='" + id + "'";
cmd = new SqlCommand(Q, Class1.con);
Class1.con.Open();
cmd.ExecuteNonQuery();
Class1.con.Close();
cmd.Dispose();
fill();
cl();
MessageBox.Show("Done");
الكود هدا كود التعديل و لكنه لايعمل
-----------------------------------------------------------------------------
كود داتا جريد فيو لينقل البيانات الي textbox قبل التعديل
b = dataGridView1.CurrentRow.Index;
id = Convert.ToInt32(dataGridView1.Rows[b].Cells[0].Value);
TextBox1.Text = dataGridView1.Rows[b].Cells[1].Value.ToString();
TextBox2.Text = dataGridView1.Rows[b].Cells[2].Value.ToString();
TextBox3.Text = dataGridView1.Rows[b].Cells[3].Value.ToString();
TextBox4.Text = dataGridView1.Rows[b].Cells[4].Value.ToString();
DateTimePicker1.Text = dataGridView1.Rows[b].Cells[5].Value.ToString();
cmd = new SqlCommand(Q, Class1.con);
Class1.con.Open();
cmd.ExecuteNonQuery();
Class1.con.Close();
cmd.Dispose();
fill();
cl();
MessageBox.Show("Done");
الكود هدا كود التعديل و لكنه لايعمل
-----------------------------------------------------------------------------
كود داتا جريد فيو لينقل البيانات الي textbox قبل التعديل
b = dataGridView1.CurrentRow.Index;
id = Convert.ToInt32(dataGridView1.Rows[b].Cells[0].Value);
TextBox1.Text = dataGridView1.Rows[b].Cells[1].Value.ToString();
TextBox2.Text = dataGridView1.Rows[b].Cells[2].Value.ToString();
TextBox3.Text = dataGridView1.Rows[b].Cells[3].Value.ToString();
TextBox4.Text = dataGridView1.Rows[b].Cells[4].Value.ToString();
DateTimePicker1.Text = dataGridView1.Rows[b].Cells[5].Value.ToString();