Okay folks, it's gonna get messy
I've trying to build a basic FAQ engine so we can add additional information to our products as and when the call centre finds something.
I'm trying to get the code to first loop through the questions in one category before moving on to another (and eventually on to the FAQ answers in a similar fashion)..
I've got the code listing through the categories as I want, but I hit an exception error before I can move on to the rest of the code.
Code:
<%
strSQL = "SELECT * FROM FAQ WHERE SiteCode = '" & strSiteCode & "' AND InfoType = 'default' ORDER BY Category ASC;"
OpenDB()
Do While Not rsProdSearch.EOF
strCat = rsProdSearch("Category")
%><b><%=strCat%></b><br/><%
Do While rsProdSearch("Category") = strCat
%><a href="#<% = rsProdSearch("ID") %>"><%=rsProdSearch("Question")%>?</a><br/><%
If Not rsProdSearch.EOF then
rsProdSearch.MoveNext
end if
Loop
%><p/>!<%
Loop
%>Blah<p/><%
CloseDB()
%>
rest of code in here later..
OpenDB and CloseDB open up the connection to the database, and work fine, so no need to worry about those
The "!" and "Blah" are just a couple of pointers so I can see what the code is doing..
The result is more or less:
Code:
Information
Test
Is this a test??
Some Other Stuff?
!Test2
Some More Stuff to Do?
Is this another Test??
error '80020009'
Exception occurred.
/Intranet/includes/FAQ_page.asp, line 25
Line 25 is " Do While rsProdSearch("Category") = strCat "
I initally thought the MoveNext was causing the error from hitting the EOF while trying to loop, but adding the if statement didn't do anything, nor did changing the loop statement to add "AND Not rsProdSearch.EOF"..
Any ideas? (Apart from telling me I create the messiest code in the world )