[thelist] ASP.NET datagrids - displaying JOIN data

holmegm at comcast.net holmegm at comcast.net
Wed Sep 17 06:51:59 CDT 2003


My google skills are failing me on this one ...

I'm starting to (slowly) move my intranet pages
from classic ASP to ASP.NET.  I'm really trying
to use the built in classes (else why bother?).

I have a query:

SELECT Workaround.Workaround_Number,
 Workaround.Workaround_HD_Call,
 Workaround.Workaround_Short_Problem,
 Workaround.Workaround_Date,
 Screen.Screen_Name
FROM Workaround INNER JOIN (Screen
 INNER JOIN Workaround_Screen
 ON Screen.Screen_ID =
 Workaround_Screen.Screen_ID)
 ON Workaround.Workaround_ID =
 Workaround_Screen.Workaround_ID;

Each Workaround has its own information, and
is linked by a crossover table to a Screen
table.  So there can be multiple screens per
Workaround.  This means if there are three screens
for a given Workaround, there will be three rows
in the results, which will differ only in the
Screen column.

In the past, I have just looped over the query
results, adding the screens to an array and only
outputing a table row when I get to a new Workaround.
So the visual result is like:

Wkrd # | HD Call | Shrt Problem | Date   | Screen(s)
17     | 123456  | Blah, blah   | 2/3/03 | ABCD, EFGH

rather than

Wkrd # | HD Call | Shrt Problem | Date   | Screen(s)
17     | 123456  | Blah, blah   | 2/3/03 | ABCD
17     | 123456  | Blah, blah   | 2/3/03 | EFGH

Is there an elegant way I can do this in ASP.NET,
with something like a datagrid?  I'm not being very
successful finding any examples.  Maybe I just don't
know the right search terms?  I'd appreciate any pointers!

Thanks,

Greg Holmes



More information about the thelist mailing list