Advanced Dataset Merge Question

G

Guest

I have two datasets from different databases that I would like to perform a left outer join on and bind the result to a datagrid. I am attempting this buy merging the datasets into one dataset. I would like the shemas to merge but what is happening is that the table from dataset "b" is copied into dataset "a" and remaining a separate table within dataset "a". Is this what I should expect? If so, I have created a parent child relation object and added that to the dataset "a" with table "a" being the parent of the merged table "b". I have bound my datagrid to table "a" of the merged dataset but the relationship is ignored and only the fields in table "a" are visible. How do I get all the fields of table "a" and the corresponding fields from "b" to showup in the grid? The fields from table "b" should be null if the child relationship can not obtain a result with the parent table "a".
 
M

Miha Markic [MVP C#]

Hi,

Merge only merges tables with same name and both have to have primary key
defined if you want join like merge.
Another solution would be:
See

HOW TO: Implement a DataSet JOIN helper class in Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;326080&Product=vcSnet

or

HOW TO: Implement a Custom DataView Class in Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;325682&Product=vbNET

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

TomC said:
I have two datasets from different databases that I would like to perform
a left outer join on and bind the result to a datagrid. I am attempting this
buy merging the datasets into one dataset. I would like the shemas to merge
but what is happening is that the table from dataset "b" is copied into
dataset "a" and remaining a separate table within dataset "a". Is this what
I should expect? If so, I have created a parent child relation object and
added that to the dataset "a" with table "a" being the parent of the merged
table "b". I have bound my datagrid to table "a" of the merged dataset but
the relationship is ignored and only the fields in table "a" are visible.
How do I get all the fields of table "a" and the corresponding fields from
"b" to showup in the grid? The fields from table "b" should be null if the
child relationship can not obtain a result with the parent table "a".
 

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