The code I have is for individual tables I have it go through each one however, after a awhile I realized that the tables could be put into a dataset and referenced.
here is what I have:
Dim IDlibrary As DataSet = New DataSet("all_tables")
Dim Profileadaptor = New SqlDataAdapter
Dim Deathadaptor = New SqlDataAdapter
Dim cbpa As SqlCommandBuilder = New SqlCommandBuilder(Profileadaptor)
Dim cbda As SqlCommandBuilder = New SqlCommandBuilder(Deathadaptor)
Profileadaptor.SelectCommand = New SqlCommand("select * from " + "[Profile]", sqlconn1)
Profileadaptor.SelectCommand.ExecuteNonQuery()
Profileadaptor.Fill(profiledt)
IDlibrary.Tables.Add(profiledt)
Deathadaptor.SelectCommand = New SqlCommand("select * from " + "[Death]", sqlconn1)
Deathadaptor.SelectCommand.ExecuteNonQuery()
Deathadaptor.Fill(deathdt)
IDlibrary.Tables.Add(profiledt)
after all changes, if any, I have a section just for those:
Dim changedtable As DataTable
changedtable = profiledt.GetChanges
If Not IsNothing(changedtable) Then
Profileadaptor.UpdateCommand = cbpa.GetUpdateCommand()
Profileadaptor.Update(changedtable)
Profileadaptor.Dispose()
End If
'death table
changedtable = deathdt.GetChanges
If Not IsNothing(changedtable) Then
Deathadaptor.UpdateCommand = cbda.GetUpdateCommand()
Deathadaptor.Update(changedtable)
Deathadaptor.Dispose()
End If
here is what I am aiming for to some degree:
For Each tab As DataTable In IDlibrary.Tables
changedtable = tab.GetChanges()
If Not IsNothing(changedtable) Then
End If
Next
what I am having an issue with is the sqldataadaptors, I need to somehow be able to access a list of saldataadaptors, but I do not know how. also I am not sure if I need the datatable change table, maybe it could be written
If Not IsNothing(tab.GetChanges()) Then
not sure.
What I have tried:
tried to make sqltableadaptor that could reference all adaptors, but I could not get that to work. I am hoping that someone can lead me down the right direction.