我正在尝试连接到我的 NorthwindDataSet,当用户单击我希望将数据保存回数据库的按钮时。当我运行下面的代码时,我没有收到任何错误,但没有保存数据。我想我正确连接到 DataSet 并且不知道为什么这不能保存回来。
NorthwindDataSetTableAdapters.CustomersTableAdapter north = new NorthwindDataSetTableAdapters.CustomersTableAdapter();
NorthwindDataSet.CustomersDataTable northtable = north.GetData();
NorthwindDataSet northwindDataSet1 = new NorthwindDataSet();
NorthwindDataSet.CustomersRow newCustomersRow =
northwindDataSet1.Customers.NewCustomersRow();
newCustomersRow.CustomerID = "5";
newCustomersRow.CompanyName = "Alfreds Futterkiste";
northwindDataSet1.Customers.Rows.Add(newCustomersRow);
northwindDataSet1.Customers.AcceptChanges();