Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to build a table layout

Reply
Thread Tools

How to build a table layout

 
 
CD
Guest
Posts: n/a
 
      10-18-2005
I would like some guidance as to how to proceed to build a webpage in asp or
aspx. I am going to hit a SQL db needing to get the following data:

SELECT ServerName,PrimaryTech FROM tblservers GROUP BY
PrimaryTech,ServerName

The idea is to display the data in a table format where the Column header
would the PrimaryTech and under each tech would the ServerName they are
responsible for.

ie.....
John Matt Joe
Srv1 Srv3 Srv2
Srv4 Srv6 Srv14

TIA
CD


 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-18-2005
You'll wind up with data like:

John Srv1
Joe Srv14
Joe Srv2
Matt Srv3
John Srv4
Matt Srv6


Throw in an order by clause, ORDER BY PrimaryTech,ServerName so you have
data like:

Joe Srv14
Joe Srv2
John Srv1
John Srv4
Matt Srv3
Matt Srv6

Unfortunately, when you write out tables in HTML, your only option is to go
left to right, and top to bottom. You can't do columns at a time. So, then
the question becomes an HTML design issue. If you want to keep this all in
one query, as opposed to executing a query for each person, you could do
something like:



<table border="1">
<tr>
<%

Dim sOldname, sCurrentname
sOldname = ""

Do while not yourRecordset.EOF
sCurrentname = yourRecordset.Fields.Item("PrimaryTech").Value
If sCurrentname <> sOldname Then Response.Write "<td>"
Response.Write yourRecordset.Fields.Item("ServerName").Value & "<br>"
sCurrentname = yourRecordset.Fields.Item("PrimaryTech").Value
If sCurrentname <> sOldname Then
Response.Write "<td>"
Response.Write sCurrentname & "<br>"
End If
Response.Write yourRecordset.Fields.Item("ServerName").Value & "<br>" &
vbCrLf

yourRecordset.MoveNext
sOldname = sCurrentname
sCurrentname = yourRecordset.Fields.Item("PrimaryTech").Value
If sCurrentname <> sOldname Then Response.WRite "</td>"
Loop
%>
</tr>
</table>



Ray at work




"CD" <> wrote in message
news:...
>I would like some guidance as to how to proceed to build a webpage in asp
>or aspx. I am going to hit a SQL db needing to get the following data:
>
> SELECT ServerName,PrimaryTech FROM tblservers GROUP BY
> PrimaryTech,ServerName
>
> The idea is to display the data in a table format where the Column header
> would the PrimaryTech and under each tech would the ServerName they are
> responsible for.
>
> ie.....
> John Matt Joe
> Srv1 Srv3 Srv2
> Srv4 Srv6 Srv14
>
> TIA
> CD
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Choosing Layout: Css-Layout or Table-Layout hpourfard@gmail.com ASP .Net 1 06-19-2006 10:06 AM
Table-based layout to CSS layout Guybrush Threepwood HTML 20 06-11-2006 11:12 AM
CSS Layout question - how to duplicate a table layout with CSS Eric ASP .Net 4 12-24-2004 04:54 PM
SWsoft Acronis Disk Director Suite 9.0 Build 508, Acronis OS Selector 8.0 Build 917, Acronis Partition Expert 2003 Build 292, Acronis Power Utilities 2004 Build 502, F-SECURE.ANTI vIRUS.PROXY v1.10.17.WINALL, F-SECURE.ANTI vIRUS v5.50.10260 for CITRI vvcd Computer Support 0 09-25-2004 01:38 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57