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
 
Ugh.
From: http://betav.com/blog/billva/2006/08/
It turns out it isn't a code issue at all, it is a default settings in
Express issue. Problem solved, after many hours wasted.
Sorry for the wasted bandwidth, but maybe this will help someone else in the
future.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top