Groups | Blog | Home
all groups > dotnet ado.net > october 2007 >

dotnet ado.net : How do I merge tables in ado.net


Maspr
10/18/2007 1:18:00 PM
PO
10/18/2007 3:24:55 PM
Hi,

I'm fairly new to ado.net and I'm not sure I'm doing this in the best way...
I retrieve two tables from two different databases and place them in a
dataset. Both tables have a column which relates them. The relation type is
one to many.

I use a custom procedure to "merge" the two tables into a third before I
display the third table in a datagrid. The procedure creates a new table and
iterates through the two tables using a relation object and GetChildRows.

Is this how it should be done or is there a built in function that can do
the work for me?

Regards
Pete

Brian Lampe
10/18/2007 9:03:34 PM
[quoted text, click to view]

If by "merge", you mean do a JOIN like INNER or LEFT JOIN, I believe
you are right.

Check this out: http://support.microsoft.com/kb/326080



Cor Ligthert[MVP]
10/19/2007 12:00:00 AM
PO,

In the way as you in my idea described it.

A windowforms datagrid (not a web one or a datagridview) can hold related
tables by just setting the datasource direct to the dataset without a
datamember.

I don't find it nice looking. As you want to make flat rows from it before,
then I would do it in the same way you wrote or select them in a flat way
direct by the Sql script Select by joining the tables in whatever way.
However I did not have the idea that it was what you asked.

Cor
PO
10/19/2007 12:11:53 AM
Yes, sorry, I ment JOIN not MERGE.
The two tables have different columns and data except for one column which I
use to join them.

The kb article contains all the info I need - thanks!

Regards
Pete


"Brian Lampe" <gr8brain@gmail.com> skrev i meddelandet
news:1192741414.556270.14240@q5g2000prf.googlegroups.com...
[quoted text, click to view]

Adrian Moore
10/19/2007 7:14:29 AM
Try the assembly at
http://www.queryadataset.com/documentation/merge-command.aspx. It supports
a MERGE statement against tables in a DataSet. Its the same functionality
and syntax as supported in the upcoming SQL-Server 2008.

Download a trial version for .NET 1.1 or .NET 2.0/3.0 here:
http://www.queryadataset.com/download.aspx

Hope this helps
Adrian Moore.
http://www.queryadataset.com


[quoted text, click to view]

Adrian Moore
10/23/2007 5:20:03 PM
Try the assembly at
http://www.queryadataset.com/documentation/merge-command.aspx. It supports
a MERGE statement against tables in a DataSet. Its the same functionality
and syntax as supported in the upcoming SQL-Server 2008.

Download a trial version for .NET 1.1 or .NET 2.0/3.0 here:
http://www.queryadataset.com/download.aspx

Hope this helps
Adrian Moore.
http://www.queryadataset.com

AddThis Social Bookmark Button