My application uses multiple forms. One of the forms is an Add form from where a New Customer along with his/her details like address, phone, city, state etc can be added. Another form is for the Product Details to be added.
I want to know how to retrieve a CustomerID from an MS Access 2007 database for either the newly added Customer or an existing one and insert multiple rows or records for the same CustomerID, as a Customer can order multiple products. I am using the following code for the Add button:
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
MyBindingSource.EndEdit()
DialogResult = Windows.Forms.DialogResult.OK
End Sub
This code adds a new Customer into the datatable and later calling update() to enter into the database with an AutoIncremented CustomerID. I have a different code for AutoIncrementing the CustomerID so the user does not have to add a new CustomerID himself and makes duplicate entries or silly mistakes. When the Add button is clicked, a Add New Record form opens with an AutoIncremented ID.
Now I need to know how to add 2 or more Product Details or in other words rows/records for this same CustomerID.
How can I do this ?
Can anyone help please ?
This post has been edited by smohd: 14 November 2011 - 12:59 AM
Reason for edit:: Code tags added. Please use [code] tags when posting codes

New Topic/Question
Reply



MultiQuote




|