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();
이 자료를 사용한 지 오래되었지만 DataSet과 DataAdapter 간의 연결은 무엇입니까? CustomersTableAdapter 인스턴스가 Update() 또는 사용자 지정 메서드를 통해 업데이트를 수행 할 것으로 기대합니다. –
TableAdapter 북쪽에서 Update 메서드를 호출 할 필요가 없습니까? –