请教C#WINFORM gridview用按钮添加一条记录
展开全部
用强类型数据集绑定很容易实现。
添加新记录的按钮事件:
private void button1_Click(object sender, EventArgs e)
{
employeesBindingSource.AddNew();
}
更新数据库的按钮的事件:
private void button2_Click(object sender, EventArgs e)
{
NorthwindDataSet.EmployeesDataTable employees =(NorthwindDataSet.EmployeesDataTable) northwindDataSet.Employees.GetChanges(DataRowState.Added);
employeesTableAdapter.Update(employees);
}
添加新记录的按钮事件:
private void button1_Click(object sender, EventArgs e)
{
employeesBindingSource.AddNew();
}
更新数据库的按钮的事件:
private void button2_Click(object sender, EventArgs e)
{
NorthwindDataSet.EmployeesDataTable employees =(NorthwindDataSet.EmployeesDataTable) northwindDataSet.Employees.GetChanges(DataRowState.Added);
employeesTableAdapter.Update(employees);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询