Join Two datasets

I

Imran Aziz

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.
 
W

William \(Bill\) Vaughn

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.
__________________________________
 
I

Imran Aziz

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.
 
W

William \(Bill\) Vaughn

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.
__________________________________

Imran Aziz said:
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.

William (Bill) Vaughn said:
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.
__________________________________
 

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