Newbie Needs help Displaying Data.

Results 1 to 2 of 2

Thread: Newbie Needs help Displaying Data.

  1. #1
    Join Date
    Dec 1969
    Posts
    5

    Default Newbie Needs help Displaying Data.

    I am new at ASP and would like some help. I have an access database containing a table holding a Main Category and Sub categories. The sub category has the parent ID of the main category. I am able to display the man category and all sub categories. I want to display just a certain number of sub-categories. Like... <BR><BR>Main category = animals has 14 sub-categories I only want to display the first five sub- categories. <BR><BR>My code looks like this: <BR><BR>Dim cn <BR>Dim cid <BR>Dim rsSub <BR>Dim qid <BR>Dim count <BR><BR><BR>rowsPerPage=5 <BR><BR>qid = Request.QueryString("cat") <BR><BR>if isblank(qid) then qid = 0 <BR><BR>sql = "Select * from ClassCategory " <BR>sql = sql & " Where ClassCategory.parent = " & qid <BR>sql = sql & " ORDER BY Category " <BR><BR>Set cn = dbConn(false) <BR>Set rs = Getrs(cn,sql) <BR><BR>While not rs.EOF and count &#060; rowsperpage <BR>&#039;DISPLAY MAIN CATEGORY <BR>response.write "&#060;tr bgcolor=#ffff00&#062;&#060;td colspan=2&#062;" <BR>response.write "&#060;a class=L2 href=test.asp?cat=" & rs("ID") & "&#062;" & rs("category") & "&#060;/a&#062;" <BR>response.write "&#060;/td&#062;&#060;/tr&#062;" <BR><BR>sql = "SELECT * FROM ClassCategory WHERE Parent = " & rs("ID") <BR>set rssub = GetRs(cn,sql) <BR><BR>&#039;DISPLAY SUB CATEGORY <BR>While not rssub.eof and count &#060; rowsperpage <BR>sql = sql & " where cid =" & rssub("id") & " " <BR><BR>cid = rs("id") <BR><BR>response.write "&#060;tr bgcolor=#F9F7DE&#062;&#060;td nowrap with=50&#062;&#060;img src=/images/trans.gif width=30 height=1&#062;&#060;/td&#062;" <BR>response.write "&#060;td width=100% &#062;&#060;a class=L1 href=test.asp?cat=" & rssub("ID") & "&#062;" & rssub("category") & "&#060;/a&#062;&#060;/td&#062;&#060;/tr&#062;" <BR><BR>rssub.movenext <BR>Wend <BR><BR>Call CleanUp(rssub) <BR>rs.movenext <BR>Wend <BR><BR>call cleanup(rs) <BR>call cleanup(cn) <BR><BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    2,050

    Default RE: Newbie Needs help Displaying Data.

    sql = "SELECT TOP 5 * FROM ClassCategory WHERE Parent = " & rs("ID")<BR><BR>~~Chaotix

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •