473,394 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to build a table layout

CD
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
Oct 18 '05 #1
1 1435
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" <mc****@hotmail.REMOVETHIS.com> wrote in message
news:eD**************@TK2MSFTNGP15.phx.gbl...
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

Oct 18 '05 #2

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

Similar topics

9
by: alex | last post by:
Hi, It seems like HTML 4.01 Transitional spec. doesn't allow table height to be expressed in percents. When i have this doctype tag: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01...
61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
7
by: mr_burns | last post by:
hi, is the table percent value for height used for displaying in browsers. i have a table i want to run to the bottom of the screen so it seemed best to set the height value to 100%. when i...
39
by: Zak McGregor | last post by:
Hi all Are there any good solutions to aligning form field names and input boxes without resorting to tables? I am struggling to do this nicely at the moment. Thanks Ciao Zak
12
by: Rick DeBay | last post by:
I'm trying to create a layout table, where the spacing between rows varies. I've tried using setting margin-top and border-top for the rows I wan't spaced down from the one above, and I've also...
47
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
16
by: Michael Rozdoba | last post by:
I'm far from a CSS expert, but what I see of it I really like & I love keeping content & style separate. I also hate the way table layout produces convoluted bulky code. However when asked why...
4
by: Rob Freundlich | last post by:
I have some servlet-generated tabular data that I need to present, so I'm using an HTML Table. In some cases, it can be quite large. I'm flushing the servlet output every N lines to push the data...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.