Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I save record modifications in the SQL database

Status
Not open for further replies.

KiaKia

Programmer
Mar 30, 2008
59
US
Hi everyone,
I am new in SQL, and Visual Studio 2008, I am following the "Walkthrough: Creating a Simple Data Application" at the end I modify some records and save them before closing my application form. but when I re-execute my application, all modifications are gone, seems like the changes are not saved in the data source.

Any comment will be appreciated.

Thanks,
Kia


 
Could you show us the code you are using to save them please?

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Hi Harleyquinn,
I have added "Customer" and "SalesOrderDetail" tables to my form as data bindings. And here is the code in Click event of the form's save item.

Private Sub CustomerBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerBindingNavigatorSaveItem.Click
Me.Validate()
Me.CustomerBindingSource.EndEdit()
Me.SalesOrderDetailBindingSource.EndEdit()
Me.SalesOrderHeaderBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.AdventureWorksDataSet)

End Sub
 
KiaKia,
You need to either do an update on your data adapter or you need to do an sql update statement in your code to save your updates.

Here is a link on how to do sql server updates, inserts and deletes.:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top