Sign in to follow this  

[.net] C#: Changes not appearing in MSSQL DB, after adding a row

Recommended Posts

Trying to add a new row to a "Customers" table; customerData is a strongly-typed DataSet which points to a local MSSQL database in my C# project.
customerData.CustomersRow custrow = customerData.Customers.NewCustomersRow();
custrow.CustomerID = 20;
custrow.CustomerName = "BrianCO";

The above code executes fine, but then when I close the program and look at the database which it connects to, the new row is nowhere to be seen... Any suggestions? I'm fairly new to using databases in C#, so it's entirely possible I'm just doin' it wrong... [Edited by - BTownTKD on April 22, 2009 2:44:18 PM]

Share this post

Link to post
Share on other sites
Are you sure that the row is being inserted into the database?

My knowledge of this is rusty, I'll admit, but it looks to me like you might be adding your new row to the local DataSet which is then not committing to the actual underlying database.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this