Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Well, I have spent uncountless hours searching for examples on how to code a web project that utilizes relationships between multiple tables without any luck. I found numerous examples of how to iterate through a single one-to-many realtionship but that was about as adventurous as it got.

 

My challenge (see atttached relationships) is to generate a datagrid with the following output;

 

Customer #

Last Name

Order #

Order Date

Item Desc

Order Qty

Order Date

Unit Price

Ext Price

 

Can anyone point me to a good reference or provide some sage advice on how to navigate through the relationships to produce the required output?

 

Thanks in advance for your help.

Tate

  • Moderators
Posted
This can be solved with a single Select statement, the question is how do you plan on displaying the data to the user, will you use a single datagrid or parent/child grids or something else.
Visit...Bassic Software
  • Moderators
Posted

Here's a Select that will give you the required columns...

 

SELECT C.CustNum, C.LastNAme,

O.OrderNum, O.OrderDate,

I.Description, L.LIQuantity,

I.Cost, I.Price

FROM (Customer AS C INNER JOIN Orders AS O ON C.CustNum = O.OrdCustNum)

INNER JOIN (Item AS I INNER JOIN OrderLineItem AS L ON I.IemNum = L.LIItemNum)

ON O.OrderNum = L.LIOrdNum

Visit...Bassic Software
Posted
Thanks I see how the SQL statement is utilized now. My hope is to utilize a datagrid to display the results. So I can use the SELECT statement when creating the data adapter. Now. most of the time when I fill a dataset a specific table is given as part of the syntax. How do you accomplish this when multiple tables are involved or should a dataview be created?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...