newbie- updating linked tables on form closing

  • Thread starter Thread starter Keith R
  • Start date Start date
K

Keith R

I'm currently trying to update the source database with the contents of my
two gridviews when exiting the program. I've found some code for updating
one row at a time, but I don't need that- I can work with the local copy of
the data until the program closes (I'm just trying to get the data to be
persistent so I can use it when the program loads again).

I think I'm close, but I haven't been able to find any examples that
save/update more than one row at a time; I want to populate the entire local
copy (or at least any changes) back to the source database.

On a related note: I have two tables (so far) that are linked, and I've
noticed that I can delete a row from the main table and not get any error,
even though there are linked records that are now left "parentless". As part
of the update process, is there an easy way to automatically delete orphaned
child rows?

Thanks,
Keith

Private Sub MainForm_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

Me.MonkeyMainTableAdapter.Update(Me.MonkeyMasterTableDataSet)

End Sub
 
I thought I was getting closer, but still no love- any thoughts on the
following?

Dim ModifiedInfo As MonkeyMasterTableDataSet.MonkeyMainDataTable = CType( _
MonkeyMasterTableDataSet.MonkeyMain.GetChanges(Data.DataRowState.Modified),
MonkeyMasterTableDataSet.MonkeyMainDataTable)

If Not ModifiedInfo Is Nothing Then
MonkeyMainTableAdapter.Update(ModifiedInfo)
End If
 
Back
Top