Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

JOIN queries

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
milese@saxonmtg.com - 24 Aug 2005 23:44 GMT
I want to run a query such as the following:

>select * from table1 left join table2 on table1.id=table2.table1_id left join table3 on table1.id=table3.table1_id where table1.id=X

I want to stuff the results in a DataSet and be able to access field
values like the following:

dataSet.Table["table1"].Rows[0]["field1"]

Currently, the DataSet is flat containing all fields from the 3 tables.
So accessing a field looks like:

dataSet.Table[0].Rows[0]["field1"]

I'd like a DataSet with 3 Tables.  The reason is the tables may have
field names which are the same.  Under the 1 flat table scenario, field
names that are the same get a number added to the end, such as
"field11".  A DataSet with 3 tables generated would be more 'elegant'.

Any suggestion?  Thanks in advance.
Brendan Green - 25 Aug 2005 01:26 GMT
Read each table into a DataTable (and put it in your dataset).

Then, add constraints to link the tables together.

>I want to run a query such as the following:
>
[quoted text clipped - 17 lines]
>
> Any suggestion?  Thanks in advance.
milese@saxonmtg.com - 26 Aug 2005 14:37 GMT
"Read each table ...".  Read each table with separate select
statements?  I thought about that but I was hoping to do this with 1
trip to the database.

I'll give this a shot, thanks.

> Read each table into a DataTable (and put it in your dataset).
>
[quoted text clipped - 21 lines]
> >
> > Any suggestion?  Thanks in advance.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.