DataSet / DataTable question

M

Marcel Hug

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top