I have the same problem can someone help
here is the test code:
deletetable is two columns only
ACRM.deletetableDataTable table = new ACRM.deletetableDataTable();
DataRowCollection rc;
DataRow newRow;
rc = table.Rows;
newRow = table.NewRow();
newRow[1] = "hello";
rc.Add(newRow);
the code runs but nothin gets written .. what are we doig wrong?
I have been following this tutorial ( http://msdn2.microsoft.com/en-us/library/ms233763(vs.80).aspx ) and so far everything has gone well. I am running Visual Studio 2005 and SQL Server 2005. I can run queries just fine. However, when I try to update (insert a new row), my Customers table in my SampleDatabaseDataSet will not commit any new changes.
I am using this documentation for adding rows: http://msdn2.microsoft.com/en-us/library/5ycd1034(VS.80).aspx
Here is my code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace TestApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { SampleDatabaseDataSet.CustomersRow newCustomersRow = sampleDatabaseDataSet.Customers.NewCustomersRow(); newCustomersRow.CustomerID = "AABCD"; newCustomersRow.CompanyName = "AAA Works"; sampleDatabaseDataSet.Customers.Rows.Add(newCustomersRow); // Why won't these changes commit? customersTableAdapter.Update(newCustomersRow); sampleDatabaseDataSet.Customers.AcceptChanges(); customersBindingSource.EndEdit(); this.customersTableAdapter.Fill(this.sampleDatabaseDataSet.Customers); } } }When this runs, the form displays that the row was added correctly. However, after the program is finished executing, the data is not written to the table. The changes don't really commit. Any ideas? Thanks.