Multi-DataTable Joins

Tags:
Development
I need to join two (or more) DataTables in a SQL statement and fill a third DataTable with the resulting records, while disconnected from the databases that filled the first two DataTables. I have researched a dozen books and the online help, but can't find any mention of this. Can it be done? Thanks

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can do this, but the way is indirect. The key to your path is the ADO.NET DataRelation Class. You can find pre-written help on Microsoft’s support site:

326080 HOW TO: Implement a DataSet JOIN helper class in Visual C# .NET

http://support.microsoft.com/default.aspx/kb/326080/EN-US/?

Or,

325688 HOWTO: Implement a DataSet JOIN helper class in Visual Basic .NET

http://support.microsoft.com/default.aspx/kb/325688/EN-US/?

These are a part of a series and Microsoft seems to have lost the index page, so you can find the others by entering the following into a Google search box:

“dataset helper class” site:support.microsoft.com

Or, enter ‘Dataset “helper class”‘ on the Microsoft KnowledgeBase search page:

http://support.microsoft.com/search/

Go ahead and use the DataSet JOIN helper class but make sure you at least look over the code to find out how joins can be emulated by using the DataRelation.

Enjoy!

John Tobler
CSharpener’s Weblog:

http://weblogs.asp.net/jtobler/

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following