|
rdouglass -> RE: ADODB.Field error ' 80020009' (11/27/2002 10:22:53)
|
Based on the code above, you could do something like this: Add 2 variables to the DIM line; something like: DIM Conn1, cql1, t, numberOfColumns, filler Then set your column count and filler variables; let' s use 4: numberOfColumns = 4 ' change to number of columns desired filler = " " Then we would change the fillup code so that we check ' t' to see when it equals number of columns: IF t=numberOfColumns THEN Then we' d use ' fillers' like so: FOR x = t TO numberOfColumns filler = filler & " <td> </td>" NEXT Response.write(filler & " </tr>" & vbcrlf) The code that I posted above would now look something like: <%
DIM Conn1, cql1, t, numberOfColumns, filler
cql1=" SELECT Category FROM cat WHERE Channel=' Automobiles' ;"
set Conn1=Server.CreateObject(" ADODB.Recordset" )
Conn1.Open cql1, " DSN=eau"
t = 0
numberOfColumns = 4
filler = " "
' Check for no records
IF Conn1.eof THEN
response.write " Your ID does not match any entries.<br>Please report the following:<br>" & cql1 & " <br>To the database administrator..."
Conn1.close
set Conn1=nothing
ELSE %>
<table border=" 0" cellpadding=" 0" cellspacing=" 0" width=" 100%" ><tr>
<%
DO WHILE NOT Conn1.EOF%>
<td width=" 50%" ><img border=" 0" src=" ../../img/but-gr.gif" >
<font face=" Arial, helvetica" size=" 2" ><%=Conn1(" Category" )%></font></td>
<%
t = t + 1
IF t=numberOfColumns THEN
Response.Write(" </tr><tr>" )
t = 0
END IF
LOOP
' Fill last table cell(s) where necessary
IF t=0 THEN
t=4
END IF
FOR x = t TO numberOfColumns
filler = filler & " <td> </td>"
NEXT
Response.write(filler & " </tr>" & vbcrlf)
Conn1.close
set Conn1=nothing END IF %>
|
|
|
|