求解update后的问题
if (textBox1.Text.Trim().ToString() == null && textBox2.Text.Trim().ToString() != null && textBox3.Text.Trim().ToString() == "" && textBox4.Text.Trim().ToString() == "" && textBox5.Text.Trim().ToString() == "" && textBox6.Text.Trim().ToString() == ""){
connection.Open();
string updatasql = "update student set 性别='" + textBox2.Text + "'where 学号='" + name + "'";
string selectsql = string.Format("select 姓名,性别,出生日期,出生地,民族,毕业学校 from student where 学号='{0}'", name);
command = new SqlCommand(updatasql, connection);
if (command.ExecuteNonQuery() == 1)
{
MessageBox.Show("更新成功");
}
else
MessageBox.Show("更新失败");
adapter = new SqlDataAdapter(selectsql, connection);
dataset = new DataSet();
adapter.Fill(dataset);
dataGridViewShow.DataSource = dataset.Tables[0];
connection.Close();
}
这是更新的代码,运行成功可把姓名给删了怎么回事
这是两个运行的截图,求各位指导指导