2
我用sql數據庫製作了一個C#程序。我使用從數據源中拖放來創建表單。但是當我按下保存按鈕時,數據不會保存在數據庫中。BindingNavigator保存按鈕不會將數據保存到數據庫中
自動生成的代碼是
namespace test3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void tableTest3BindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
Validate();
this.tableTest3BindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.test3DataSet);
//this.tableTest3TableAdapter.Update(this.test3DataSet.TableTest3); // I tried to add this line but it also not work !!
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'test3DataSet.TableTest3' table. You can move, or remove it, as needed.
this.tableTest3TableAdapter.Fill(this.test3DataSet.TableTest3);
}
}
}
我一定要添加一些代碼或更改屬性,當我創建了以下在網站上的步驟數據庫的方式,它必須是正確的。