|
-
Mar 26th, 2008, 08:31 AM
#1
Thread Starter
Addicted Member
How to enable VB to delete rows in a relational database?
Hello, I am trying to learn VB.net for simple programming and database functionality.
I have been working through some online tutorials at www.homeandlearn.co.uk and have used their visual basic code for adding, updating and deleting rows from their example database.
The homeandlearn.co.uk example is a single-table database.
The code for their "delete" button is -
If MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.No Then
MsgBox("Operation Cancelled")
Exit Sub
End If
Dim cb As New OleDb.OleDbCommandBuilder(da)
ds.Tables("AddressBook").Rows(inc).Delete()
MaxRows = MaxRows - 1
inc = 0
NavigateRecords()
da.Update(ds, "AddressBook")
My question is - if the database was relational, ie had another table related to the table "addressbook", how do I alter the above code to execute a delete of related data in both of the tables?
If for example I had another table called "User" which was related to "addressbook"...
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
|