为什么这样没有更新成功啊?请高手解答。。。。
private DataSet dataset = new DataSet();private SqlDataAdapter dataadapter;
private void Form2_Load(object sender, EventArgs e)
{
dataGridView1.RowHeadersVisible = false;
string sql = string.Format("select id,姓名,地址,数学,语文,计算机,英文,体育 from 学生成绩表");
string connstring = "Data Source=.;Initial Catalog=wang;Integrated Security=true";
SqlConnection connection = new SqlConnection(connstring);
dataadapter = new SqlDataAdapter(sql, connection);
dataadapter.Fill(dataset);
dataGridView1.DataSource = dataset.Tables[0];
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("确定要将修改保存到数据库吗?","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Question);
if(result==DialogResult.OK)
{
SqlCommandBuilder builder = new SqlCommandBuilder(dataadapter);
dataadapter.Update(dataset);
}
}