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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

databse display in tabular form

Status
Not open for further replies.

manoj

IS-IT--Management
Jun 21, 2000
4
GB
Sir,
Using the FrontPage , I am able to show a databse on web. The commands used is response.write(objrs(i)).
However, (inside a loop), the displayed fields are not coloumnwise, ...means that the blank spaces of all fields gets trimmed, hence some lines are long and others are medium/short depending on the contents.

I am a beginer , Kindly let me know how to show the databse in tabular form or any other uniform way.

thanking you in advance
M.Manoj
 
What are the names of the columns in the table?
 
The solution to this is to change how the ASP page is writing the HTML code. For a tubular listing, you will probably want it to write the rows of a table. It should look something like this:

Code:
<table width='100%'>
  <tr>
    <td width='25%'>Column 1</td>
    <td width='25%'>Column 2</td>
    <td width='25%'>Column 3</td>
    <td width='25%'>Column 4</td>
  </tr>
<%
  ' This code assumes that the connection to the table is open
  Do While NOT DBTable1.EOF
    Response.Write("  <tr>" & vbCrLf)
    Response.Write("    <td width='25%'>" & DBTable1("Field1") & "</td>" & vbCrLf)
    Response.Write("    <td width='25%'>" & DBTable1("Field2") & "</td>" & vbCrLf)
    Response.Write("    <td width='25%'>" & DBTable1("Field3") & "</td>" & vbCrLf)
    Response.Write("    <td width='25%'>" & DBTable1("Field4") & "</td>" & vbCrLf)
    Response.Write("  </tr>" & vbCrLf)
    DBTable1.MoveNext
  Loop
%>
</table>

Basically, this will write a new row to the table for each item in the table, until EOF (End of File) is met. I included the use of vbCrLf to allow the response.write statements to generate standard looking HTML, but this is not a necessary component.

Now, you could also do this using CSS and the [ignore]<DIV>[/ignore] and [ignore]<span>[/ignore] DHTML components.

-Brian-
I'm not an actor, but I play one on TV.
 
One trick I use is to use alternate row colours:

<table width="100%" cellspacing="0" cellpadding="5">
<%
Do While Not rs.EOF
%>
<tr <% If counter/2=int(counter/2) Then Response.Write(" bgcolor='FFFFCC'") %>>
<td><% = rs("Field1") %></td>
<td><% = rs("Field2") %></td>
<td><% = rs("Field3") %></td>
</tr>
<%
counter=counter+1
rs.MoveNext
Loop
%>
</table>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top