I'm hoping you all can help me since I think I'm missing
something obvious here. I'm trying to write asp code to display the
values from my database in the form of a color-coded table. It works
great except for some reason, I'm getting a bunch of blank space
before the table finally shows up (you have to scroll down quite a
bit before you can actually see the table). Please help!
<%
' First let us create Connection and Recordset
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.RecordSet")
showblank=" "
shownull="-null-"
' Open the connection to the ODBC source, in this case
' the Access database
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" +
Server.MapPath("\fpdb\Users.mdb")
' Now, create the SQL statement
sSQL = "SELECT * FROM MemberRoster WHERE (Type = 'Primary') AND
(Status Like 'Guild Leader' OR Status Like 'Guild Officer' OR Status
Like 'Member' OR Status Like 'New Member') AND (Class LIKE 'Druid' OR
Class LIKE 'Monk' OR Class LIKE 'Beastlord') ORDER BY Class
ASC,EQName ASC"
' Execute the SQL statement, and set the recordset object
' to the result of this execution. We obtain the resulting
' records in Rs object
Set Rs = Conn.Execute(sSQL)
If Rs.EOF Then
response.write "No records matched<br>"
response.write sSQL & "<br>So cannot make table..."
conn.close
set conn=nothing
response.end
end if
%>
<table border="1" width="100%" cellspacing="0" bgcolor="#6B75B5"
style="border-collapse: collapse; color: #FFFFCC" cellpadding="0">
<tr>
<% 'Put Headings On The Table of Field Names %>
<td width="150">Name </td>
<td width="66"><%=Rs.Fields("Head").name%> </td>
<td width="66"><%=Rs.Fields("Chest").name%> </td>
<td width="66"><%=Rs.Fields("Legs").name%> </td>
<td width="66"><%=Rs.Fields("Feet").name%> </td>
<td width="66"><%=Rs.Fields("Arms").name%> </td>
<td width="66"><%=Rs.Fields("Wrist1").name%
> </td>
<td width="66"><%=Rs.Fields("Wrist2").name%
> </td>
<td width="66"><%=Rs.Fields("Hands").name%> </td>
</tr>
<% ' Now lets grab all the records
Do while NOT rs.eof %>
<tr>
<%
'Set background color for CoVFaction
myKey = Rs.Fields("CoVFaction")
Select Case myKey
CASE "Max Ally" %><td width="100" style="background-color:
#00FF00">
<% CASE "Non-KOS" %> <td width="100" style="background-
color: #FFFF00">
<% CASE "KOS" %> <td width="100" style="background-color:
#FF0000">
<% CASE "Unknown" %> <td width="100">
<% CASE ELSE %> <td width="100">
<% End Select %>
<% if isnull(Rs.Fields("MageloLink").value) then %>
<font color=black><%=Rs.Fields("EQName").value%
></font> </td>
<% else %>
<a href="<%=Rs.Fields("MageloLink").value%>"><%=Rs.Fields
("EQName").value%></a></font></td>
<% end if %>
<%
'Set background color for Head
myKey = Rs.Fields("Head")
Select Case myKey
CASE "> SS" %><td width="66" style="background-color: maroon">
<% CASE "SS" %> <td width="66" style="background-color:
blue">
<% CASE "~ SS" %> <td width="66" style="background-color:
blue">
<% CASE "> Thurg" %> <td width="66" style="background-
color: #10988A">
<% CASE "Thurg" %> <td width="66" style="background-color:
green">
<% CASE "~ Thurg" %> <td width="66" style="background-
color: green">
<% CASE "Kunark" %> <td width="66">
<% CASE "> Planar" %> <td width="66">
<% CASE "Planar" %> <td width="66" style="background-
color: purple">
<% CASE "~ Planar" %> <td width="66" style="background-
color: purple">
<% CASE "< Planar" %> <td width="66" style="background-
color: gray">
<% CASE ELSE %> <td width="66">
<% End Select %>
<%=Rs.Fields("Head").value%> </td>
</tr>
<%
rs.movenext
LOOP
%>
</table>
<%
' Close the Recordset object and destroy it
Rs.Close
Set Rs = Nothing
' You might want to release the resources for connection object,
' unless you want to use the same connection again in the later code
Conn.Close
Set Conn = Nothing
%>