Saving Dataset changes back to database using vb.net
Posted on 2014-01-28
I am trying to save changes that I have made to a dataset/data table back to the database. I am populating the data table as follows:
Dim cn As New SqlConnection(Global_Values.sConn)
Dim da As New SqlDataAdapter(sSQL, cn)
Dim ds As New DataSet
If cn.State = System.Data.ConnectionState.Closed Then
Dim x_Age As String
For Each row As DataRow In ds.Tables("search_result").Rows
row("Age") = Calc_Age(row("Date_Of_Birth")) <----- calls function to calc age
now how do I update the records in the database with the changes I just made? Each row has a unique column named Rec_ID. The column in the database that I want to update for each record is Age.
Ant help would be appreciated as I am new to this.