Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2004, 09:12 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help displaying data in table

<%
Dim objConn, objRS, strQ, objProp
Dim strconnection

Set objConn = Server.CreateObject("ADODB.Connection")
strConnection = "Provider=sqloledb;Data Source=FLMIRSQL02;"
strConnection = strConnection & "User ID=Source_Forms_User;Password=password;"
objConn.Open strConnection

Set objRS = Server.CreateObject("ADODB.Recordset")
Set objRS.ActiveConnection = objConn

objRS.Open ="Select Top 10* FROM Escalation_Forms"

%>
<CENTER><table border='5%'>

<%
DIM iRecordCount
iRecordCount = 0
DO WHILE NOT objRS.EOF and iRecordCount <> 5
%>



<tr>
<th>Ticket Number
<th>Customer First Name
<th>Customer Last Name
<th>Customer Phone Number
<th>Account Number
<th>Customer's Comment




<tr>
<td><%Response.Write objRS("Ticket_Number")%>
<td><%Response.Write objRS("First_Name")%>
<td><%Response.Write objRS("Last_Name")%>
<td><%Response.Write objRS("Phone_Number")%>
<td><%Response.Write objRS("Account_Number")%>
<td><%Response.Write objRS("Cust_Com")%></td></tr>




<%


    iRecordCount = iRecordCount + 1
objRS.MoveNext
Loop


objRS.close
objConn.Close

Set objRS = Nothing
Set objConn = Nothing
%>


</table></CENTER>

</body>


 
Old July 1st, 2004, 10:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

Not sure what you want specifically; if you use DHTML, you can add some styling to it that will make the presentation better. In addition, you can always use images in the td tags to make the appearance look smoother. In addition, the cellspacing and cellpadding affect how much spacing exists between cells and how much space is is around the inner area of the cell.

In addition, you don't have to use the center tag, the table supports align="center". I would recommend a good HTML/DHTML book for styling and effects.

Brian
 
Old July 1st, 2004, 08:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Calibus,

You have not said what the problem you face with this code. Just placing the code here, won't get you the right help from here. But having a glimpse at the code, I would suggest you to do the following.

Any TABLE related tags that you start should be closed appropriately, else you would not see the table displayed as expected. As brian said, I too would recommend you a good HTML book.

Also take a look at Table Tag and other HTML tags

Code:
......
<table border="1" cellspacing="2" cellpadding="2">


<%
DIM iRecordCount
iRecordCount = 0
DO WHILE NOT objRS.EOF and iRecordCount <> 5 'not sure what you are trying to do with the code in red here
%>

<tr>
<th>Ticket Number</TH>
<th>Customer First Name</TH>
<th>Customer Last Name</TH>
<th>Customer Phone Number</TH>
<th>Account Number</TH>
<th>Customer's Comment</TH>
</TR> 

<tr>
<td><%Response.Write objRS("Ticket_Number")%></TD>
<td><%Response.Write objRS("First_Name")%></TD>
<td><%Response.Write objRS("Last_Name")%></TD>
<td><%Response.Write objRS("Phone_Number")%></TD>
<td><%Response.Write objRS("Account_Number")%></TD>
<td><%Response.Write objRS("Cust_Com")%></td></tr>

<%    
    iRecordCount = iRecordCount + 1
    objRS.MoveNext
Loop

objRS.close
objConn.Close 

Set objRS = Nothing 
Set objConn = Nothing
%> 

</table>
</body>
This should show you the table as expected.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 2nd, 2004, 08:40 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried the changes you recommended and it works!

Thanks a millions!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying record from a look up table stecol Classic ASP Databases 2 February 1st, 2007 10:31 AM
Displaying DetailsView for New/Empty Data Table Sheri B ASP.NET 2.0 Basics 5 December 7th, 2006 03:08 PM
Displaying data in a table Mike707 Dreamweaver (all versions) 1 April 19th, 2006 01:43 PM
Displaying Excel data in a table badgolfer ASP.NET 1.0 and 1.1 Basics 6 January 6th, 2006 04:25 AM
Displaying Access table data into Msflexgrid using Kaustav Pro VB Databases 0 September 25th, 2005 01:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.