脚步,
- 具有单一表单的 Crate 窗口应用程序
- 从数据添加新数据源->添加新数据源
- 转到数据-> 显示数据源
- 删除任何表格以形成。此步骤将添加两个控件。一个。数据网格视图 B. 绑定导航器
按 F5 运行。
我可以查看所有记录,但无法添加/更新/删除。
下面是 VS 生成的表单代码。
namespace TestingGrid
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void testBindingNavigatorSaveItem_Click( object sender, EventArgs e )
{
this.Validate();
this.testBindingSource.EndEdit();
this.testTableAdapter.Update( this.testDataSet.Test );
}
private void Form1_Load( object sender, EventArgs e )
{
// TODO: This line of code loads data into the 'testDataSet.Test' table. You can move, or remove it, as needed.
this.testTableAdapter.Fill( this.testDataSet.Test );
}
}
}