Christopher Francisco
Christopher Francisco

Reputation: 16278

VB.NET TableAdapter insert query not saving to database

I created an INSERT query to my UsersDataSet. (right-click -> new query -> sql -> insert). After calling UsersTableAdapter.InsertUser(user,pass,firstname,lastname), I notice the query executes successfully but the data is not saved to the database. Why is this happening?

PS: I have done this before and it do saves.

Upvotes: 1

Views: 1686

Answers (2)

Christopher Francisco
Christopher Francisco

Reputation: 16278

This is super stupid, the issue was that since I copied the MS Access file, everytime I rebuilt the project, the database file was also overwritten, along with the previous build files, with the blank database file I set as the datasource

Upvotes: 1

Serialize
Serialize

Reputation: 491

You have to call TableAdapter.Update() to persist the changes back to the database. You are creating a row in the datatable, but not pushing your changes to the data source.

See http://msdn.microsoft.com/en-us/library/bz9tthwx.aspx

Upvotes: 0

Related Questions