Closed Thread Icon

Topic awaiting preservation: Show data not whole one line but couples of line problem (ASP) (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12979" title="Pages that link to Topic awaiting preservation: Show data not whole one line but couples of line problem (ASP) (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Show data not whole one line but couples of line problem (ASP) <span class="small">(Page 1 of 1)</span>\

 
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 11-13-2003 07:40

Hi, guys. How are you?
Please help me.
You know when we show the data from database using ASP, it is pretty easy to show each record on one line.
But I want to show each record on three line.
I want to show name, company on the first line.
Then Price on second line and Award on the third line.
At that moment, my code shows everything on one line.
My code is:

code:
<table>
<%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
Set conn= Nothing
%>
</table>



I am thinking of how to modify this code to what I want to achieve.
I did something like:

code:
<table>
<%Do Until rs.EOF%>
<tr>
<% For each x in rs.Fields
If x.name = "WineryName" or x.name = "Name" Then %>

<td><%Response.Write(x.value)%></td>
<%End If%>

<%Next%>
<%rs.MoveNext%>
</tr>

<tr>
<% For each x in rs.Fields
If x.name = "Price" or x.name = "Vintage" Then %>

<td><%Response.Write(x.value)%></td>
<%End If%>

<%Next%>
<%rs.MoveNext%>
</tr>

<%
Loop
rs.Close
conn.Close
Set conn= Nothing
%>
</table>



I made another table row inside of For loop. I thought I could make second row including Price and Vintage field.
But it does not work.
Hmmm........Do you know what I mean?
Please help!

Hiroki Kozai

Rhino
Bipolar (III) Inmate

From: New Jersey, USA
Insane since: Jul 2003

posted posted 11-13-2003 11:09

If you want to print out the data like you are, I would just make it easier on yourself and not loop through each of the data fields like you are with the For each statement that you are using. I would actually just pull the actual field from the RecordSet itself like....

<%Do Until rs.EOF
Response.Write("<tr>")
Response.Write("<td>")
Response.Write(rs("name"))
Response.Write("</td>")
Response.Write("<td>")
Response.Write(rs("WineryName"))
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td colspan=""2"">")
Response.Write(rs("Price")
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td colspan=""2"">")
Response.Write(rs("Award")
Response.Write("</td>")
Response.Write("</tr>")

rs.MoveNext

Loop
%>

Hope this helps

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 11-13-2003 23:11

Wow, that is cool.
It worked fine.
Cheers, mate.


Hiroki Kozai

« BackwardsOnwards »

Show Forum Drop Down Menu