RE: datatable and sql Adapter
- From: Peter Bromberg [C# MVP] <pbromberg@xxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 19 Apr 2008 12:35:00 -0700
when you select in the data for the parent and child tables, your parent
table will need a primary key ID column, and the child table will need a
"parentID" column that matches which row in the parent table the child row is
associated with.
Then, when you've got your 2 tables in your DataSet, you create a
DataRelation to enforce the relationship.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"daveL" wrote:
Hello,.
c#2 , sqlserver 2005
I am parsing a Text File into 2 Datatables
Parent we'll say invoice
child well say Invoice Items
parent rows 10,000, child rows 30,000
the 2 Tables start out Empty, i get the table structures from the Database
"select top 0 from parenttable")
same for the items Table, then i parse the text file into
the 2 Datatables Disconnected from Server
My question is....when inserting into the database
how am i to get the child rows (items) the id key of the parent to complete
the relation in a Batch Update
or do i need to make dynamic sql with @@identity
and insert 1 row Parent set child ids then insert the child rows
is there a example of how to accomplish this with dataset,datatables and
sqlAdapter
Thanks
- Follow-Ups:
- Re: datatable and sql Adapter
- From: daveL
- Re: datatable and sql Adapter
- References:
- datatable and sql Adapter
- From: daveL
- datatable and sql Adapter
- Prev by Date: Highligting property grid lines
- Next by Date: RE: Zip files in C#
- Previous by thread: datatable and sql Adapter
- Next by thread: Re: datatable and sql Adapter
- Index(es):
Relevant Pages
|