Please Help me before I sever my wrists with my pocket protector. Please take a look at the following code, if you have the time...the problem I have is that it does not filter the results that are displayed....if there are any glaring errors that I have missed I will apologise most profusely
This all happened because a page that I had written before stopped working for no apparent reason..I am suspecting a database error....I manipulated the code which eliminated the error (which was
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Invalid use of Null
/nProducts.asp, line 111
the altered code which works but does not filter is this:
Thanks in advance
This all happened because a page that I had written before stopped working for no apparent reason..I am suspecting a database error....I manipulated the code which eliminated the error (which was
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Invalid use of Null
/nProducts.asp, line 111
the altered code which works but does not filter is this:
Code:
<%
'Session("Newproduct") = Request("num")
If Session("Newproduct") = "0" Then
FlagTrueCount = 0
Set rst1 = cnn.Execute("select * from categories where parentID=0 order by sequence")
If Not rst1.EOF Then
Do Until rst1.EOF
PrintedFlag = False
Set rst2 = cnn.Execute("select * from categories where parentID=" & cInt(rst1("CategoryID")) & " order by sequence")
Do While NOT rst2.EOF
Set rst3 = cnn.Execute("select * from categories where parentID=" & cInt(rst2("CategoryID")) & " order by sequence")
Flag = False
Do While NOT rst3.EOF
Flag = False
If Session("Newproduct") > "" Then
Set rst4 = cnn.Execute("select count(*) as cnt from tblproduct where cInt(NPnumber) =" & cInt(Request("num")) & " And category=" & cInt(rst3("CategoryID")))
Else
Set rst4 = cnn.Execute("select count(*) as cnt from tblproduct")
End If
If rst4("cnt") > 0 Then
Flag = True
FlagTrueCount = FlagTrueCount + 1
If PrintedFlag = False Then
%>
<tr>
<td>
</td>
<td>
<img width="13" src="images/<%=rst1("Categoryid")%>.gif">
</td>
<td>
<font face="Arial, Helvetica, sans-serif" color="" size="2">
<b><%= uCase(rst1("CategoryName")) %></b>
</font>
</td>
</tr>
<%
End If
Exit Do
End If
rst3.MoveNext
Loop
If Flag = True Then
%>
<tr>
<td>
</td>
<td>
</td>
<td>
<a href="Subcategorynp.asp?ID=<%= rst2("ParentID") %>&CatID=<%= rst2("CategoryID") %>">
<font face="Arial, Helvetica, sans-serif" color="#666666" size="1">
<b><%= uCase(rst2("CategoryName")) %></b>
</font>
</a>
</td>
</tr>
<%
PrintedFlag = True
' Exit Do
End If
rst2.MoveNext
Loop
rst1.MoveNext
%>
<!--
<tr>
<td colspan="3">
</td>
</tr>
-->
<%
Loop
If FlagTrueCount = 0 Then
%>
<tr>
<td>
No Highlight products in this Category
</td>
</tr>
<%
End If
End If
Else
Set rst1 = cnn.Execute("select * from categories where parentID=0 order by sequence")
If Not rst1.EOF Then
Do Until rst1.EOF
%>
<tr>
<td>
</td>
<td>
<img width="13" src="images/<%=rst1("Categoryid")%>.gif">
</td>
<td>
<font face="Arial, Helvetica, sans-serif" color="" size="2">
<b><%= uCase(rst1("CategoryName")) %></b>
</font>
</td>
</tr>
<%
Set rst2 = cnn.Execute("select * from categories where parentID=" & cInt(rst1("CategoryID")) & " order by sequence")
Do While NOT rst2.EOF
%>
<tr>
<td>
</td>
<td>
</td>
<td>
<a href="Subcategorynp.asp?ID=<%= rst2("ParentID") %>&CatID=<%= rst2("CategoryID") %>">
<font face="Arial, Helvetica, sans-serif" color="#666666" size="1">
<b><%= uCase(rst2("CategoryName")) %></b>
</font>
</a>
</td>
</tr>
<%
rst2.MoveNext
Loop
rst1.MoveNext
%>
<tr>
<td colspan="3">
</td>
</tr>
<%
Loop
End If
End If
%>
Thanks in advance