I'm working on a website in work at the moment which will give a list of publications held in an Access database. The field "Class"(category) I'm using to generate a menu on the left. Click on a category and it'll bring up all the publications under that category. Now I've two problems with what I've done so far.
Firstly if you go to this page you will see that the category "Customer Information and External Guidance" has been repeated twice. Why I do not know! I've used the lookup wizard to pull the categories in from another table in the db so the should be no spelling mistakes etc.
Secondly if you click on a category it only pulls out text before the loop in my script. Click refresh, nothing happens, click the category again and the info I want pulled out is displayed, weird!
Here's the script
[VBS] <%
Dim cn
Dim rs
Dim strconn
Dim strSQL
set cn = CreateObject("ADODB.Connection")
strconn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db/dfppubs.mdb")
cn.open strconn
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM PUBLICATIONS ORDER by Class"
rs.open strSQL, strconn
tempClass = "null"
Do until rs.eof
If rs("Class")<>tempClass then
Response.Write "<tr><td><a href=publicationslist.asp?Category=" & Server.URLEncode(rs("Class")) & " class=submenu>" & rs("Class") & "</a></td></tr>" & vbCrLf
Response.Write "<tr><td width=180 bgcolor=#999966><img src=../pics/space.gif width=180 height=1 border=0></td></tr>"
tempClass = rs("Class")
headerCount = headerCount + 1
End If
rs.movenext
Loop
rs.close
cn.close
%>[/VBS]






Bookmarks