DatasetTableAdapters.CustomerDataAdapter customerData = new DatasetTableAdapters.CustomerDataAdapter();
customerData.insertQuery("Value1", "Value");为什么没有将记录插入到数据库中?我正在使用数据集设计器。
发布于 2011-07-18 06:11:30
也许可以试试这样的东西?
DatasetTableAdapters.CustomerDataAdapter customerData = new DatasetTableAdapters.CustomerDataAdapter();
//make instance of the applicable customerDataTable here
customerData.Fill(customerDataTable);
customerDataTable.Rows.Add("Value1", "Value");//<-you could also add the values directly to your dataset here instead of the datatable
customerData.Update(customerDataTable);我在winforms应用程序中使用此方法。也许你可以编辑它,以满足你的需要?
发布于 2011-07-18 05:33:44
请尝试在表适配器上使用.Insert方法。
http://msdn.microsoft.com/en-us/library/ms233812(v=vs.80).aspx
https://stackoverflow.com/questions/6726862
复制相似问题