关于datagridview如何更新的问题,执行后有问题,高手解答!!!!
namespace 作业1{
public partial class manage : Form
{
public manage()
{
InitializeComponent();
}
private void manage_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“dbDataSet1.table_user”中。您可以根据需要移动或删除它。
this.table_userTableAdapter.Fill(this.dbDataSet1.table_user);
//允许添加、允许删除、允许编辑
this.dataGridView1.AllowUserToAddRows = true;
this.dataGridView1.AllowUserToDeleteRows = true;
this.dataGridView1.ReadOnly = false;
}
private void tableuserBindingSource_CurrentChanged(object sender, EventArgs e)
{
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
//提交数据更改到数据库
this.table_userTableAdapter.Update(this.dbDataSet1);
}
private void button2_Click(object sender, EventArgs e)
{
//回滚所有的更改
this.dbDataSet1.RejectChanges();
}
}
}