I think what you want is to insert the child data, with the primary ID from
the parent table.
Parent table:
ParentID Name FName
Child Table:
ID Address ParentID
Child Table 2
ID PhoneNumbers ParentID
You would perform an InsertStatment like This:
INSERT INTO ParentTable (name,Fname) VALUES
DECLARE @pid as int
SELECT @pid=@@IDENTITY -- there are better ways of doing this, for example
row locking
--- Now insert into child tables
INSERT INTO Child1 (address, parentid) VALUES('',@pid)
INSERT INTO Child1 (PhoneNumbers, parentid) VALUES('',@pid)
"Frank Py" <fp*@proactnet.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I want to relate 2 tables in Access or SQL for a one to many. I would
like to find an example in .Net for data entry for this structure. For
example, I would like customer info at the top of the page and customer
history at the bottom. Maybe the details section can be in a editable
grid control and the customer header can be just form controls. Is there
any known code samples for what I'm trying to do?
Code examples appreciated. Thanks.
Frank
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!