Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP table formatting

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a table consisting of 5 columns and 'x' records in an access database. I have connected and can display the records with headers with the following code:

set rs = Server.CreateObject("ADODB.recordset")
sql="SELECT * FROM WebFinErr"
rs.Open sql, conn
%>

<table border=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<%for each x in rs.Fields
response.write(&quot;<th>&quot; & x.name & &quot;</th>&quot;)
next%>
</tr>
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
<td><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close
%>

I want the 5th column record with it's header to display below the first 4 column records and headers then to loop through the table displaying similarly. An example is as below:

col1header col2header col3header col4header
col1record col2record col3record col4record
col5header
col5record
col1header col2header col3header col4header
col1record col2record col3record col4record
col5header
col5record
col1header col2header col3header col4header
col1record col2record col3record col4record
col5header
col5record
and so on.....

Any help from anyone would make a friend for life!!
 
Try...

SQL1 = &quot;SELECT NAME FROM WEBFINERR&quot;
SQL2 = &quot;SELECT VALUE FROM WEBFINERR&quot;

RS1.OPEN SQL1,Conn
RS2.OPEN SQL2,Conn

<TABLE BORDER=0 WIDTH=100>
<% Do while not RS.EOF
Response.Write &quot;<TR><TD>&quot; & RS1(&quot;Name&quot;) & &quot;</TD>&quot;
RS1.MoveNext
Response.Write &quot;<TD>&quot; & RS1(&quot;Name&quot;) & &quot;</TD>&quot;
RS1.MoveNext
Response.Write &quot;<TD>&quot; & RS1(&quot;Name&quot;) & &quot;</TD>&quot;
RS1.MoveNext
Response.Write &quot;<TD>&quot; & RS1(&quot;Name&quot;) & &quot;</TD>&quot;
RS1.MoveNext
Response.Write &quot;</TR>&quot;
Response.Write &quot;<TR><TD>&quot; & RS2(&quot;Value&quot;) & &quot;</TD>&quot;
RS2.MoveNext
Response.Write &quot;<TD>&quot; & RS2(&quot;Value&quot;) & &quot;</TD>&quot;
RS2.MoveNext
Response.Write &quot;<TD>&quot; & RS2(&quot;Value&quot;) & &quot;</TD>&quot;
RS2.MoveNext
Response.Write &quot;<TD>&quot; & RS2(&quot;Value&quot;) & &quot;</TD>&quot;
RS2.MoveNext
Response.Write &quot;</TR>&quot;
Response.Write &quot;<TR><TD>&quot; & RS1(&quot;Name&quot;) & &quot;</TD></TR>&quot;
RS1.MoveNext
Response.Write &quot;<TR><TD>&quot; & RS2(&quot;Value&quot;) & &quot;</TD></TR>&quot;
RS2.MoveNext
Loop
%>

You may need to but some checking in place to see if a value is null before doing the response.write otherwise when you hit EOF you will get errors.

Hope This Helps...

Gary


-GTM Solutions, Home of USITE-
-=
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top