DatasetTableAdapters.CustomerDataAdapter customerData = new DatasetTableAdapters.CustomerDataAdapter();
customerData.insertQuery("Value1", "Value");
开发者_高级运维
The record is not being inserted into the Database Why? I am using Dataset Designer.
Try something like this maybe?
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);
I am using this method in a winforms app. Maybe you could just edit it to suit your needs as applicable?
Try using the .Insert
method on the table adaptor instead.
http://msdn.microsoft.com/en-us/library/ms233812(v=vs.80).aspx
精彩评论