471,321 Members | 1,826 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,321 software developers and data experts.

DataSet / DataTable question

Hello NG !
I have a tricky question about dataSet and dataTable.
In my app I have 2 databases. In the first (called A1) database are the
whole datas but I'm interesting in one table tbl1 (with 20 attributes). To
communicate with the DB A1 I have a lib, which gives me a dataset of this
table tbl1 (with all attributes).

This dataset i would like to give the lib for my second DB A2. In this DB A2
is a table tbl2 which has just some of the attributes of tbl1 (tbl2 is like
a backup table for some attributes of A1.tbl1).
the lib for the A2 database should write all attributes from the dataset of
A1, which holds all attribues from A1.tbl1 into the database A2.tbl2, if the
attribute exists.

Now I would like to know, whats the best way for doing that. Can I use the
Fill-Methode or do I have to use a SQL-Statement (INSERT INTO tbl2 (att1,
att2, att2) select.....

Thanks for help
Regards
Marcel Hug
Dec 6 '05 #1
1 1198
You should be able to use the dataset merge metod, you need to use the ignore
enumerator to only add columns (attributes) from the A1 table into the A2
table.

e.g.

dataset2.Merge(dataset1, true, MissingSchemaAction.Ignore);

above dataset1 would be from A1 and dataset2 would be from A2

I hope this is the answer you are looking for.

Steven.

"Marcel Hug" wrote:
Hello NG !
I have a tricky question about dataSet and dataTable.
In my app I have 2 databases. In the first (called A1) database are the
whole datas but I'm interesting in one table tbl1 (with 20 attributes). To
communicate with the DB A1 I have a lib, which gives me a dataset of this
table tbl1 (with all attributes).

This dataset i would like to give the lib for my second DB A2. In this DB A2
is a table tbl2 which has just some of the attributes of tbl1 (tbl2 is like
a backup table for some attributes of A1.tbl1).
the lib for the A2 database should write all attributes from the dataset of
A1, which holds all attribues from A1.tbl1 into the database A2.tbl2, if the
attribute exists.

Now I would like to know, whats the best way for doing that. Can I use the
Fill-Methode or do I have to use a SQL-Statement (INSERT INTO tbl2 (att1,
att2, att2) select.....

Thanks for help
Regards
Marcel Hug

Dec 6 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Jason Huang | last post: by
15 posts views Thread by JIM.H. | last post: by
2 posts views Thread by Carl Summers | last post: by
12 posts views Thread by Marc | last post: by
8 posts views Thread by John | last post: by
4 posts views Thread by Robert Bravery | last post: by
7 posts views Thread by =?Utf-8?B?QWxla3MgS2xleW4=?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.