473,769 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data Web Controls & Join SQL Queries

I'd like to know if there is a best approach, in terms of using the Data Web
Controls (i.e. DataGrid, DataList & Repeater), for displaying data that is
the result of a query that joins two tables that have a one-to-many
relationship. For instance if I perform a query on two such tables, I might
expect that there would be data repeated on multiple rows from table on the
one side of the relationship. What I want to do is display an HTML table
row, or something similar, (using one of the Data Web Controls) on a web
page for each "group". A group being the set of rows that has the same
repeated data (dictated by the join).

For example, I might have a Company table and an Employee table. If I do a
query joining these two (assuming some design decisions here), I'd have
company data repeated in many rows for each employee that works for that
company. I'd like to display the data in a row-based design on a web page
that, for each display row, has the company data once and then the employee
data for each employee that works for that company. So, the display would
be (conceptually) something like this:

ACME Works Ltd. New York, NY

John Doe - hired: 7/8/1986
Jane Smith - hired: 9/1/2004
Bob Harris - hired: 3/5/2002

---------------------------------------------

ABC Company Inc. San Diego, CA

Bob Smith - hired: 3/7/1999
Judy Davis - hired: 3/9/2002
John Roberts - hired: 2/3/2004

---------------------------------------------

.....

So, each "visual row" is really comprised of multiple records in the query's
result set. This is where my confusion comes in. Most of the example I
have seen with the Data Web Controls seem to have a one-to-one relationship
between a record from a query and a "visual row". There may be some
treatment of the data (i.e. change the color, make it a link), but I haven't
specifically seen an example of what I want to do. Maybe I have to do this
from scratch, but I'd like to avoid that.

Any help on how this should be accomplished would be much appreciated.
Thanks!
Nov 19 '05 #1
1 1229


Are you talking about a parent - child list of data. The company being
the parent and the employee table being the child? I think you want to
use a datagrid to display the data. Do a search on Master-Detail
Datagrids

epigram wrote:
I'd like to know if there is a best approach, in terms of using the Data Web Controls (i.e. DataGrid, DataList & Repeater), for displaying data that is the result of a query that joins two tables that have a one-to-many
relationship. For instance if I perform a query on two such tables, I might expect that there would be data repeated on multiple rows from table on the one side of the relationship. What I want to do is display an HTML table row, or something similar, (using one of the Data Web Controls) on a web page for each "group". A group being the set of rows that has the same repeated data (dictated by the join).

For example, I might have a Company table and an Employee table. If I do a query joining these two (assuming some design decisions here), I'd have company data repeated in many rows for each employee that works for that company. I'd like to display the data in a row-based design on a web page that, for each display row, has the company data once and then the employee data for each employee that works for that company. So, the display would be (conceptually) something like this:

ACME Works Ltd. New York, NY

John Doe - hired: 7/8/1986
Jane Smith - hired: 9/1/2004
Bob Harris - hired: 3/5/2002

---------------------------------------------

ABC Company Inc. San Diego, CA

Bob Smith - hired: 3/7/1999
Judy Davis - hired: 3/9/2002
John Roberts - hired: 2/3/2004

---------------------------------------------

....

So, each "visual row" is really comprised of multiple records in the query's result set. This is where my confusion comes in. Most of the example I have seen with the Data Web Controls seem to have a one-to-one relationship between a record from a query and a "visual row". There may be some
treatment of the data (i.e. change the color, make it a link), but I haven't specifically seen an example of what I want to do. Maybe I have to do this from scratch, but I'd like to avoid that.

Any help on how this should be accomplished would be much appreciated. Thanks!


Nov 19 '05 #2

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

Similar topics

3
1069
by: Vik | last post by:
I use the same dataadapters and datasets on a few aspx pages. Currently I create these data controls on each page. Is it possible to create these controls only once and then use them on the different pages? Thanks.
2
9627
by: | last post by:
I've defined an ObjectDataSource against a dataset, and I can bind the ObjectDataSource's members to data controls. I'm wondering how to take the values in an ObjectDataSource and programmatically manipulate them before they're bound to any data control. I'd be using them almost like you'd use recordset fields from Classic ADO. In other words, I would like to grab the value corresponding to a publication date from my database, use the...
5
2185
by: yma | last post by:
Hello, I tried to display a column in MS Access 2000 nwind.mdb using 3 data controls. But I got "It is already opened exclusively by another user, or you need permission to view its data." I put ole DataAdapter, Connection and dataset controls and fill in the properties of the listbox. The only code I have is OleDbDataAdapter1.Fill(DataSet11, "employees") in page_load sub.
0
868
by: Mehdi | last post by:
I have implemented custom data entity objects, so I like to bind my entities to web server data controls, so I want to know what extra code I should implement to to do that?
1
1421
by: C4rtm4N | last post by:
I'm about to embark on re-writing a database & bespoke web reporting application for our call centre & would like a little advice please. Currently the database has 10 tables containing summaried (<=1 record per staff member per day) data from different legacy systems, populated by DTS. There is an 11th table that has staff data in which is used to link the others together as many have different primary keys. After the data has been...
2
1799
by: Jim Gregg | last post by:
Hello all, I am faced with some logic that I am unsure how to handle. Imagine that I am running a WMI query and I am outputting the data into a dynamically created ASP table control. Here is my code that does this. I have left out the portion that connects to my server and the query, but this should be enough to show what I am doing. Basically it is a web page that queries SMS for clients in a certain collection, then outputs the name...
0
827
by: =?Utf-8?B?RGFu?= | last post by:
I am relatively new to ASP.NET 2.0. I did not program in 1.1. It seems as though the new Data Controls (drag and drop in Visual Studio) have been a big imrovement, from what I've read. In many instances, all I want to do is retreive a single value from the database. I have been programming it manually using Connections and Commands and Readers, but I was wondering if there is an easy way to retreive and display a simple value using the...
3
1293
by: Mirnes | last post by:
Hello! How can I show data outside of data controls (gridview, listview etc.). I want to build CSS menu with data from database table and that is the reason why I need it outside of any data control.
0
1088
by: BobLewiston | last post by:
Also, can anybody recommend good online courses for SQL and/or data controls? (I guess I should master the regular data controls before going on to Silverlight, right?)
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.