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 4 4760
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
Im Inserting into Datatables From a Text File
SqlServer does Not know this is happening
I dont have a Problem setting up the relationship
disconnected...the problem is how to NOT violate primary key/ identity
keyss, when inserting the new data to the database using sqladapter
Thanks
Dave
"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:78**********************************@microsof t.com...
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
If your database has the correct referential integrity already set up, you
cannot violate it. You can set the ContinueUpdateOnError property on the
DataAdapter, and examine the row errors collection after the update completes
to see which rows weren't inserted because of integrity / restraint
violations.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.
Site: http://www.eggheadcafe.com http://petesbloggerama.blogspot.com http://ittyurl.net
"daveL" wrote:
Im Inserting into Datatables From a Text File
SqlServer does Not know this is happening
I dont have a Problem setting up the relationship
disconnected...the problem is how to NOT violate primary key/ identity
keyss, when inserting the new data to the database using sqladapter
Thanks
Dave
"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:78**********************************@microsof t.com...
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
thanks for the help peter
"daveL" <ve***********@yahoo.comwrote in message
news:nf*****************@newssvr19.news.prodigy.ne t...
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: randy |
last post by:
Hello all,
I have a DataTable which I am building column by column and adding rows
after each new column. The DataTable columns match the columns in my
database table. I'm building the...
|
by: MrMike |
last post by:
I have the following code which allows me to display records from a table
named "lkup_Specie" in a datagrid. If I create a second datatable and a
second hashtable for a table named "lkup_Grade",...
|
by: cindy |
last post by:
Get data into datatable, add to dataset dsSearch "
Get data into datatable, add to dataset dsSearch
Using In-Memory SQL Engine join the tables and select the filenames from the
join, add to...
|
by: slaprade |
last post by:
I am loading a weeks worth of web logs into a dataset using Imports Microsoft.Data.Odbc
These are text - fixed length fields so I have written a schema for them. The adapter fill looks like this...
|
by: Danny Ni |
last post by:
Hi,
If I want to programatically add rows to a DataTable, do I call
AcceptChanges per row? Or do I call AcceptChanges after all rows added?
TIA
|
by: dauphian |
last post by:
Hello,
I am new to .net and am trying to build a report application that
queries 4 different tables based on a id, and I need to return them in
the same table for easy viewing.
Basically, I...
|
by: Niron kag |
last post by:
Hi,
I try to get a dataTable from the DB , add it a row and update it back to
the DB.
The program does not throw exception but the DB is not updated.
Can you please help me and tell me what I do...
|
by: Nick |
last post by:
I have a code that returns data in IList. My webGrid doesn't allow me to
sort with IList returned, it say it only suports DataView, DataTable and
DataSet, not IEnumerable. I don't know how to...
|
by: Maart_newbie |
last post by:
Hi all,
I've got a question about returning the value of a pk-column to a
DataTable
after inserting a row (via a data-adapter) using MySql5.
Here is the SQL and code concerned:
...
|
by: Tina |
last post by:
Can I use a sqlDataSource to fill a datatable in code? How?
Thanks,
T
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |