PDA

View Full Version : adding table lines


scroots
08-23-2002, 07:43 PM
how would i add table lines to a table in my code, i have tried but failed and got errors.
my code:

<html>
<head>
<title>Guestbook</title>
</head>
<body bgcolor="white" text="black">
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database



'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.F, tblComments.T, tblComments.D, tblComments.Di, tblComments.M, tblComments.H, tblComments.Ti, tblComments.Total FROM tblComments;"

'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon



'Write the HTML to display the current record in the recordset
Response.Write ("<table>")
Response.Write ("<tr>")
Response.Write ("<td>From</td>")
Response.Write ("<td>To</td>")
Response.Write ("<td>Description</td>")
Response.Write ("<td>Distance</td>")
Response.Write ("<td>Mag B</td>")
Response.Write ("<td>H Gain</td>")
Response.Write ("<td>Time for leg</td>")
Response.Write ("<td>Total</td>")
Response.Write ("</tr>")
'rows

'Loop through the recordset
Do While not rsGuestbook.EOF
Response.Write ("<tr>")
Response.Write ("<td>")
Response.Write (rsGuestbook("F"))
Response.Write ("</td>")

Response.Write ("<td>")
Response.Write (rsGuestbook("T"))
Response.Write ("</td>")

Response.Write ("<td>")
Response.Write (rsGuestbook("D"))
Response.Write ("</td>")

Response.Write ("<td>")
Response.Write (rsGuestbook("Di"))
Response.Write ("</td>")

Response.Write ("<td>")
Response.Write (rsGuestbook("M"))
Response.Write ("</td>")

Response.Write ("<td>")
Response.Write (rsGuestbook("H"))
Response.Write ("</td>")

Response.Write ("<td>")
Response.Write (rsGuestbook("Ti"))
Response.Write ("</td>")

Response.Write ("<td>")
Response.Write (rsGuestbook("Total"))
Response.Write ("</td>")
Response.Write ("</tr>")

'Move to the next record in the recordset
rsGuestbook.MoveNext

Loop

'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
</body>
</html>


thanks in advance
scroots

Roy Sinclair
08-23-2002, 10:58 PM
What do you mean by "table lines"? If you mean a table border then: Response.Write ("<table border=""1"">") will do the trick.

scroots
08-23-2002, 11:14 PM
yep thats it roy, table border.

thank you it makes it look so much better and is easier to read.

scroots