Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Mysterious Table Rows
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Suamere
Starting Member

27 Posts

Posted - 28 March 2005 :  23:08:25  Show Profile  Visit Suamere's Homepage  Send Suamere an AOL message  Send Suamere a Yahoo! Message
I have some ASP code here. It's a recordset that displays a from the coordinates of a database. The database has two data inputs. Column 1 is "Row" And column 2 is "Column" They act as x and y coordinates for a table. The recordset loops through all of the rows, displaying as many "td" "/td"'s as there are columns for that particular row. Then when a new row value is found, it throws in a "/tr" "tr"

The database has 900 entries, which make up a 30 x 30 table on my web site.

All of the rows are perfectly fine except rows 4 and 6. They seem to have jumped around on me a little bit:

Row 1: All 30 TD's
Row 2: All 30 TD's
Row 3: All 30 TD's
Row 4: The first 4 TD's of row 4 are there, and then TD's 24-30 of row 4, For a total of 20 TD's in this row
Row 5: All 30 TD's
Row 6: TD's 1 - 12 of Row 6 are here
Row 7: Row 4's 5-23 are here
Row 8: Row 6's 13 - 30 are here
Row 9: All 30 TD's of row 7
Row 10: All 30 TD's of row 8
Row 11: All 30 TD's of row 9, etc cleanly through row 30

The Recordset Code, if you can translate it:



<center>
<table style="background-image: url(/Images/Castletown.bmp);background-repeat: no-repeat" border=0 cellpadding=0 cellspacing=0 width=710 height=592>
<%
Response.Write("<tr>")
  rs.Open "Select * from CastleTown", conn
  %>
    <%do until rs.EOF%>
      <%for each x in rs.Fields%>
<%
TableRow2 = rs("Row")
TableData2 = rs("Column")
If TableRow2 <> TableRow1 Then
Response.Write("</tr><tr>")
End If

If TableRow2 = TableRow1 And TableData2 <> TableData1 Or TableRow2 <> TableRow1 Then
TableRow1 = rs("Row")
TableData1 = rs("Column")
PropTaken = rs("Taken")
%>
<%
If PropTaken = "Yes" Then
%>
<td>
<%
Response.Write(" ")
ElseIf PropTaken = "No" Then
%>
<td class="row1" style="cursor:hand;" onclick="window.location.href='Property.asp?Area=Hylia&Row=<%=TableRow2%>&Col=<%=TableData2%>'">
<img src="images/PropNotTaken.gif" border="0">
<%
Else
Response.Write("<td>")
End If
%>
</td>
<%
End If
%>
      <%next
      rs.MoveNext%>
    <%loop
  rs.close
%>
</tr>
</table>
</center>



You'll also notice some dual taking of the Row and Column recordset, that is so it checks to see if the row has changed, so it doesn't display the same thing twice.

If something goes wrong, find the source of the problem and break it's legs.

Suamere
Starting Member

27 Posts

Posted - 29 March 2005 :  09:41:56  Show Profile  Visit Suamere's Homepage  Send Suamere an AOL message  Send Suamere a Yahoo! Message
Okay, I'm dumb and I figured it out. I just assumed the order of the recordset couldn't be the problem, since it was in order in the database and most of the rows were fine. So I just did an Order By Rows, Columns. It works fine.. Thanks to you 11 people who read this before I responded, Ha ha.

If something goes wrong, find the source of the problem and break it's legs.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 2.05 seconds. Powered By: Snitz Forums 2000 Version 3.4.07