 |
interactive | editorial | code | resource |
|
|
Single tables |
Multiple tables |
Advanced Searching |
Demonstration using the Northwind database included with SQL server |
Advanced Demonstrations using QuickAdmin v1.1 |
|
Demonstrations > Part 2 > Many-Many
Many-Many
Many-many relationships (linking 3 tables)
To illustrate how to set up Many-many relationships with QuickAdmin, we'll use
the example of employees and their links to territories. Each employee may be
linked to many territories, each territory may be linked to many employees.
These tables are involved:
| Employees |
The Employees table. |
| EmployeeTerritories |
A 'linking table' between Employees and Territories. |
| Territories |
The Territories table |
We'll start by showing how Many-Many relationships can be included in a
QuickAdmin search. This search box is set up to search for Employees who cover
a given region. For example, entering Denver will bring up all employees
who are linked to the Denver region.
Leave the box blank and click Search in order to return all employees:
|
|
Here's the code:
<Search>
<QuickAdmin:Simple Runat=server ID="Simple1" NAME="Simple1">
<QuickAdmin:Many2Many LocalField=EmployeeID ForeignTable=Territories ForeignKeyField=TerritoryID ForeignDataField=TerritoryDescription IntermediateTable=EmployeeTerritories IntermediateLocalKey=EmployeeID IntermediateForeignKey=TerritoryID Runat=server ID="Many2many1" NAME="Many2many1"/>
</QuickAdmin:Simple>
</Search>
You can see that the Many-Many relationship is searched upon, with
EmployeeTerritories being used as the intermediate (linking) table. (See
diagram on right).
|
Demonstrations > Part 2 > Many-Many | |
|
Here's a representation of the database:  |
|
|
 |
You are not logged in. |
Quick search:
|
This site is part of the allasp.net network. Take a look at our great ASP.NET components: dbcombo.net Web combo-box that autocompletes values from the server as you type! Great for selecting from long lists. quickadmin.net Professional database admin pages in minutes rather than days! - fully ranked search / view / add / edit etc. imageadmin.net Web-based image upload manager. Lets you set criteria on uploaded images to enforce consistency. |
|