yasin5
یک شنبه 10 دی 1391, 19:00 عصر
با سلام در کد زیر با اینکه در اجرا بر روی No کلیک می کنم ولی باز هم داده ها حذف می شوندمشکل کجاست
SqlConnection scn = new SqlConnection();
scn.ConnectionString = (@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + Application.StartupPath + @"\Hospital.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlCommand scd = new SqlCommand();
scd.Connection = scn;
scd.CommandText = " delete from [Pezeshk]where code = " + System.Convert.ToInt32(maskedTextBox1.Text) + "";
dataGridView1.Rows.Remove(dataGridView1.CurrentRow );
scn.Open();
scd.ExecuteNonQuery();
if (MessageBox.Show("ایا اطمینان به حذف کردن دارید", "حذف", MessageBoxButtons.YesNo) ==DialogResult.Yes)
scn.Close();
SqlConnection scn = new SqlConnection();
scn.ConnectionString = (@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + Application.StartupPath + @"\Hospital.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlCommand scd = new SqlCommand();
scd.Connection = scn;
scd.CommandText = " delete from [Pezeshk]where code = " + System.Convert.ToInt32(maskedTextBox1.Text) + "";
dataGridView1.Rows.Remove(dataGridView1.CurrentRow );
scn.Open();
scd.ExecuteNonQuery();
if (MessageBox.Show("ایا اطمینان به حذف کردن دارید", "حذف", MessageBoxButtons.YesNo) ==DialogResult.Yes)
scn.Close();