Groups | Blog | Home
all groups > dotnet ado.net > february 2006 >

dotnet ado.net : Join Two datasets


William (Bill) Vaughn
2/28/2006 10:25:04 AM
There are a couple of options here. First, you could link the MySQL database
to SQL Server (see "linked servers" in Books Online) and do the JOIN on the
SQL Server when you fetch the data. Next, you could try to do it in place on
the client. This is tougher as ADO.NET does not include a JOIN engine. I
might try to Merge the two DataSet objects together and go from there...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

[quoted text, click to view]

Imran Aziz
2/28/2006 4:54:09 PM
Hello All,
I have a dataset that I populate using a SQL Server database, and the
second one that I populate using a mySQL Server database, I need to combine
the results in memory and then sort them, how do I go about doing that ?
This is a search query, so I do not want to create another temp table to do
this, any idea's please.

Imran.

Imran Aziz
3/1/2006 12:00:00 AM
Thanks for your response William. I will have a look at "linked Servers" as
you mentioned. I have tried the Merge method of DataSet but keep on getting
this error.

[System.Data.DataException] = {"<target>.nID and <source>.nID have
conflicting properties: DataType property mismatch."}

Any idea as to why this is happening, my piece of code is as under.

DataSet dsMT = new DataSet();
dsMT = GetSearchEntries(sSearch, intGroupID);
ds.EnforceConstraints = false;
ds.Merge(dsMT, true, MissingSchemaAction.AddWithKey);

where both the datasets have the same Schema.

Any suggestions please how to sort this issue out.

Imran.

[quoted text, click to view]

William (Bill) Vaughn
3/1/2006 8:44:50 AM
Nope... not without further study. Sahil is the expert when it comes to
merge. Perhaps he can help.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

[quoted text, click to view]

Cor Ligthert [MVP]
3/1/2006 7:45:20 PM
Imran,

If you want to merge take than your view on the datatable not the dataset.

See this simple sample on our website.

http://www.vb-tips.com/default.aspx?ID=edb1409d-5394-468f-a63f-de3a5d92b14a

The problem is mostly the key, at least in the table to merge has to have
that.

If you use the dataset, than the datatable names have to be the same.

I hope this helps,

Cor

"Imran Aziz" <imran@tb2.net> schreef in bericht
news:eQm0mfIPGHA.2628@TK2MSFTNGP15.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button