|
-
Mar 26th, 2004, 10:49 AM
#1
Thread Starter
Frenzied Member
Update database from dataset
I've got code that deletes a row from a dataset (also can add a row, haven't looked at updating yet). I want the user to make all changes to the dataset, then when done save all changes back to the database, instead of saving each time a change is made.
The user can select any of about 60 db's, which have similar but not always identical tables. I've tried code like da.Update(ds), da.Update(ds, "TableName"), etc, but get errors a/o the db doesn't update. I can run straight SQL on each change, but want to minimize the connection time.
Example of the delete code (for the dataset) below. This should be simple, but every book/example I've seen assumes a connection to just one database. Thanks.
Code:
'Delete selected record
Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles cmdDelete.Click
Dim dt As New DataTable()
Try
dt = ds.Tables("[QS]")
dt.Rows.Remove(dt.Rows(m_intCurRow))
txtQuNum.Clear()
txtQuestion.Clear()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error Deleting Record")
End Try
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|