473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Databinding 3 tables

MRW
Hello!

I've been searching and searching for an answer, so hopefully, somebody
can provide a little help! [Smile]

I have a database with three tables and their fields (made nice and
simple):

tblMain: ID, DateEntered
tblSub1: SubID, ID, Title
tblSub2: SubID, ID, Title

ID is what binds tblMain to tblSub1 and tblMain to tblSub2 (there IS a
reason there are two "sub" tables, it's just made easy for this
example)

I want to display tblSub1 and tblSub2 in a DataGrid in order by their
DateEntered, which is in tblMain. I know how to use INNER JOIN for one
table, but in this case, we have two tables (the 'subs') being linked
to one (main).

Any help would GREATLY be appreciated!

May 10 '06 #1
2 1043
use a UNION
SELECT * FROM

(
SELECT SubID, ID, Title FROM tblSub1

UNION

SELECT SubID, ID, Title FROM tblSub1
) A

ORDER BY A.ID

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"MRW" <mw*****@yahoo.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hello!

I've been searching and searching for an answer, so hopefully, somebody
can provide a little help! [Smile]

I have a database with three tables and their fields (made nice and
simple):

tblMain: ID, DateEntered
tblSub1: SubID, ID, Title
tblSub2: SubID, ID, Title

ID is what binds tblMain to tblSub1 and tblMain to tblSub2 (there IS a
reason there are two "sub" tables, it's just made easy for this
example)

I want to display tblSub1 and tblSub2 in a DataGrid in order by their
DateEntered, which is in tblMain. I know how to use INNER JOIN for one
table, but in this case, we have two tables (the 'subs') being linked
to one (main).

Any help would GREATLY be appreciated!

May 10 '06 #2
MRW
Great! Never used a UNION before. Thanks for the help!

May 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Remy De almeida | last post by:
Hi, I am working on a test application to get databinding working. This is the code to bind the data. System.Data.DataRelation relCustOrd; System.Data.DataColumn colMaster1; ...
3
by: Peter Morris [Droopy Eyes Software] | last post by:
Hi all When I bind to multiple records I use a DataList. This allows the web-designer to add code like <%#DataBinder.Eval(Container.DataItem, "Name")%> Whenever I want to retrieve a single...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
3
by: John Bailey | last post by:
When I first built a few web pages in ASP .Net 2.0, I thought it was great. The formview and detailview contorls would automatically layout the controls for you, the update methods were...
6
by: Nathan Sokalski | last post by:
I am using a DataSet as the DataSource of a DataList in my code. The SQL used to get the data from the database begins with: SELECT...
7
by: Richard | last post by:
I have a form with seven tapages. These span only one record with a large number of fields (textboxes). On Tabpage1 I display a number of read-only text boxes. This displays information about...
3
by: Dan Slaby | last post by:
I have a webservice that I want to populate a combobox on a windows form. The webservice creates the correct XML output, but when I attempt to bind it to a combobox I get this error: Additional...
3
by: Grant | last post by:
I need some sample code showing how to manipulate data in my access database using C#. This is what Im trying to do: Dropdownlist with datagrid both bound to datasource. When the drop down list...
1
by: CorporateCoder | last post by:
Hi, I am trying to bind the selected value of a databound dropdown box in a databound gridview control to the value being displayed in the template column the dropdown box has been added to. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.