DakotaChick
11-19-2007, 08:38 AM
I think I'm just missing something really simple but basicly what I'm trying to do is display data from a query using asp. I would like the table to display 2 records side by side before moving to the next row of the table:
IE: Table Cell with Record Info 1 | Table Cell with Record Info 2
Table Cell with Record Info 3 | Table Cell with Record Info 4
The problem I'm running into is when I try to use the MoveNext method inside the loop to display the 2nd record info before completing the loop and moving on to the next row, I get one of two error message depending on the Move method I use.
1) (Using MoveNext) - I get a BOF or EOF error
2) (Using Move 1,0) - I get a Bookmarks not supported error. (Access 2003)
What move method should I be using to move to the next record for the next table cell before moving on to the next row??
Heres the code I have:
<table width="299" border="0" align="center" cellpadding="0" cellspacing="5" class="ImageTables">
<%
Dim adoCon
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Mode = 3
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Inetpub\wwwroot\Turn2\admin\db\db.mdb; User Id=admin; Password="
Dim rs, strSQL
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT ArtImages.* FROM ArtImages;"
rs.CursorType = 2
rs.Open strSQL, adoCon
rs.MoveFirst
Do While Not rs.EOF
Category = rs("Cat")
ImgName = rs("ImgName")
If Category <> Last_Category Then
%>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<span class="Headings"><%=Category%></span><br />
<span class="Small">(Click image for larger view)</span>
</div>
</td>
</tr>
<%
End If
%>
<tr>
<td width="140">
<div align="center">
<% If ImgName = "comingsoon.jpg" Then %>
<img src="images/art/<%=ImgName%>" border="0" />
<% Else %>
<a href="images/art/large/<%=ImgName%>">
<img src="images/art/small/<%=ImgName%>" border="0" />
</a>
<% End If %>
</div>
</td>
<%
rs.Move 1,0 'Need Move Code Here
Category = rs("Cat")
ImgName = rs("ImgName")
%>
<td width="140">
<div align="center">
<a href="images/art/large/<%=ImgName%>">
<img src="images/art/small/<%=ImgName%>" border="0" />
</a>
</div>
</td>
</tr>
<%
Last_Category = Category
rs.MoveNext
Loop
%>
</table>
IE: Table Cell with Record Info 1 | Table Cell with Record Info 2
Table Cell with Record Info 3 | Table Cell with Record Info 4
The problem I'm running into is when I try to use the MoveNext method inside the loop to display the 2nd record info before completing the loop and moving on to the next row, I get one of two error message depending on the Move method I use.
1) (Using MoveNext) - I get a BOF or EOF error
2) (Using Move 1,0) - I get a Bookmarks not supported error. (Access 2003)
What move method should I be using to move to the next record for the next table cell before moving on to the next row??
Heres the code I have:
<table width="299" border="0" align="center" cellpadding="0" cellspacing="5" class="ImageTables">
<%
Dim adoCon
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Mode = 3
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Inetpub\wwwroot\Turn2\admin\db\db.mdb; User Id=admin; Password="
Dim rs, strSQL
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT ArtImages.* FROM ArtImages;"
rs.CursorType = 2
rs.Open strSQL, adoCon
rs.MoveFirst
Do While Not rs.EOF
Category = rs("Cat")
ImgName = rs("ImgName")
If Category <> Last_Category Then
%>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<span class="Headings"><%=Category%></span><br />
<span class="Small">(Click image for larger view)</span>
</div>
</td>
</tr>
<%
End If
%>
<tr>
<td width="140">
<div align="center">
<% If ImgName = "comingsoon.jpg" Then %>
<img src="images/art/<%=ImgName%>" border="0" />
<% Else %>
<a href="images/art/large/<%=ImgName%>">
<img src="images/art/small/<%=ImgName%>" border="0" />
</a>
<% End If %>
</div>
</td>
<%
rs.Move 1,0 'Need Move Code Here
Category = rs("Cat")
ImgName = rs("ImgName")
%>
<td width="140">
<div align="center">
<a href="images/art/large/<%=ImgName%>">
<img src="images/art/small/<%=ImgName%>" border="0" />
</a>
</div>
</td>
</tr>
<%
Last_Category = Category
rs.MoveNext
Loop
%>
</table>