If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > MoveNext Function Problem - I'm a newb

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-01-03, 17:48
tcurtis45 tcurtis45 is offline
Registered User
 
Join Date: Jun 2003
Posts: 5
Formatting database results.

I am trying to setup my database listing so that the data is sorted in multiple colums side by side. Here's the code:
Code:
<TABLE Border=1 CellPadding=3 bgColor=23415D>
<%
SQL = "SELECT * FROM tblCategory, tblBusiness " _
	  & " WHERE tblBusiness.CategoryID = tblCategory.ID " _
	  & " AND tblCategory.ID IN (" & catsChosen & ")" _
	  & " ORDER BY CategoryName, Name"

Set RS = catConn.Execute(SQL)

priorCat = ""

Do Until RS.EOF
	curCat = RS("CategoryName")
	If curCat <> priorCat Then
	Response.Write "<TR >" _
	& "<TD colspan=2 align=center>" & "<font size=4 color=FFFFFF>" & "<B>" & curCat & "</font>" & "</b>" & "</TD>" _
	& "</TR>" & vbNewLine
	priorCat = curCat
	End If
	Response.Write "<TR><TD>" _
	& "<B>" & RS("Name") & "</b>" & "<br>" & RS("Address") & "<br>" & RS("City") & ", " & RS("State") & " " & RS("Zip") & "<br>" & RS("Phone") & "</TD>" & vbNewLine
	RS.MoveNext
	Response.Write "<TD>" & "<B>" & RS("Name") & "</b>" & "<br>" & RS("Address") & "<br>" & RS("City") & ", " & RS("State") & " " & RS("Zip") & "<br>" & RS("Phone") & "</TD>" _
	& "</TR>" & vbNewLine
	Rs.MoveNext
Loop
Response.Write "</TABLE>" & vbNewLine
RS.Close

' end of displaying results from prior request...if any
'
End If
%>
The problem I am having is down at the bottom. I create one side of the table, then I want to move to the next record to create the other side. I keep getting an error 80020009 with no other information, just
index2.asp, line 63. I really am just a newb so any help you can give would be appreciated.

I have the page posted at http://www.tcurtis45.dns2go.com/index2.asp

Thank you,

Tony

Last edited by tcurtis45; 07-01-03 at 20:21.
Reply With Quote
  #2 (permalink)  
Old 07-01-03, 17:56
tcurtis45 tcurtis45 is offline
Registered User
 
Join Date: Jun 2003
Posts: 5
Update info

I didn't mention, the line that is erroring out is line 62 which is:

Response.Write "<TD>" & "<B>" & RS("Name") & "</b>" & "<br>" & RS("Address") & "<br>" & RS("City") & ", " & RS("State") & " " & RS("Zip") & "<br>" & RS("Phone") & "</TD>" _
Reply With Quote
  #3 (permalink)  
Old 07-01-03, 20:21
tcurtis45 tcurtis45 is offline
Registered User
 
Join Date: Jun 2003
Posts: 5
SupaNewb

Ok after more dileberation and finding a great article about formatting tables on your asp page at
http://www.4guysfromrolla.com/webtech/102299-1.shtml

I finally got it to work and it was not nearly as difficult as I might have thought. I will post the code that worked for me so others might be able to answer their questions.

Code:
<%
SQL = "SELECT * FROM tblCategory, tblBusiness " _
	  & " WHERE tblBusiness.CategoryID = tblCategory.ID " _
	  & " AND tblCategory.ID IN (" & catsChosen & ")" _
	  & " ORDER BY CategoryName, Name"

Set RS = catConn.Execute(SQL)

priorCat = ""

  i = 1
  do until RS.eof
	curCat = RS("CategoryName")
	If curCat <> priorCat Then
	  Response.Write "<TR >" _
	& "<TD colspan=2 align=center>" & "<font size=4 color=FFFFFF>" & "<B>" & curCat & "</font>" & "</b>" & "</TD>" _
	& "</TR>" & vbNewLine
	priorCat = curCat
	End If    
	cellString = "<TD>" & "<B>" & RS("Name") & "</b>" & "<br>" & RS("Address") & "<br>" & RS("City") _
	& ", " & RS("State") & " " & RS("Zip") & "<br>" & RS("Phone") & "</TD>"

    if not i mod 2 = 0 then
      response.write(cellString)
    else
      response.write(cellString) & "</tr><tr>" & vbNewLine
    end if		

    i = i + 1
    RS.movenext
  loop
Response.Write "<TR>" & "</TABLE>" & vbNewLine
RS.Close

' end of displaying results from prior request...if any
'
End If
%>
Thanks anyway, I'm sure you will be seeing me again.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On