Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds


  Asked By: Robert    Date: Nov 18    Category: Asp.net    Views: 1030

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=" "

' Open the connection to the ODBC source, in this case
' the Access database
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" +

' 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

' 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..."
set conn=nothing
end if
<table border="1" width="100%" cellspacing="0" bgcolor="#6B75B5"
style="border-collapse: collapse; color: #FFFFCC" cellpadding="0">
<% '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 width="66"><%=Rs.Fields("Wrist2").name%
<td width="66"><%=Rs.Fields("Hands").name%> </td>

<% ' Now lets grab all the records
Do while NOT rs.eof %>
'Set background color for CoVFaction
myKey = Rs.Fields("CoVFaction")
Select Case myKey
CASE "Max Ally" %><td width="100" style="background-color:
<% CASE "Non-KOS" %> <td width="100" style="background-
color: #FFFF00">
<% CASE "KOS" %> <td width="100" style="background-color:
<% 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
<% 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:
<% CASE "~ SS" %> <td width="66" style="background-color:
<% CASE "> Thurg" %> <td width="66" style="background-
color: #10988A">
<% CASE "Thurg" %> <td width="66" style="background-color:
<% 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>

' Close the Recordset object and destroy it
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
Set Conn = Nothing



5 Answers Found

Answer #1    Answered By: Lenora Green     Answered On: Nov 18

since it is really a classic asp  question. but I'm both places so will give it a shot but there are 150+ classic coders there who may help  you...

Do you have a URL so we can see output in a browser? If I could look at the output HTML in browser, i.e. "view source" I could nail the answer in a second.

Answer #2    Answered By: Ryan Evans     Answered On: Nov 18

Here's the webpage to look at....I looked at the "view source" and
couldn't figure it out myself. Yes it is your code  and it took me a
while to find what I was looking for...!


Answer #3    Answered By: Aamanee Khan     Answered On: Nov 18

There is a ton of frontpage themes interfering with that page. You need to figure out in Front Page (probably format menu => themes) how to disable them being introduced into the pages you write.

Answer #4    Answered By: Michele Grant     Answered On: Nov 18

Already tried that earlier and it didn't make a difference. Changed
it so no themes in there now and still have space. I think it has
something to do with cycling through the database, because if you put
a response.write statement before the rs.movenext...it prints out the
line plus empty lines. I'll add that in so you can see....

Answer #5    Answered By: Aberto Rossi     Answered On: Nov 18

 <td width="80">

in a lot of places is one big problem.

Those guys must always be inside TDs never outside.

<td width="80">  </td>

Didn't find what you were looking for? Find more on ASP/database Or get search suggestion and latest updates.