Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

suspecting a database error

Status
Not open for further replies.

nosferer

Programmer
Oct 10, 2001
5
AU
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:
Code:
                <%
'Session(&quot;Newproduct&quot;) = Request(&quot;num&quot;)
        If Session(&quot;Newproduct&quot;) = &quot;0&quot; Then
                FlagTrueCount = 0
                Set rst1 = cnn.Execute(&quot;select * from categories where parentID=0 order by sequence&quot;)
                If Not rst1.EOF Then
                        Do Until rst1.EOF
                                PrintedFlag = False
                                Set rst2 = cnn.Execute(&quot;select * from categories where parentID=&quot; & cInt(rst1(&quot;CategoryID&quot;)) & &quot;  order by sequence&quot;)
                                        Do While NOT rst2.EOF
                                                Set rst3 = cnn.Execute(&quot;select * from categories where parentID=&quot; & cInt(rst2(&quot;CategoryID&quot;)) & &quot;  order by sequence&quot;)
                                                Flag = False
                                                Do While NOT rst3.EOF
                                                        Flag = False
                                                          If Session(&quot;Newproduct&quot;) > &quot;&quot; Then
                                                                Set rst4 = cnn.Execute(&quot;select count(*) as cnt from tblproduct where cInt(NPnumber) =&quot; & cInt(Request(&quot;num&quot;)) & &quot; And category=&quot; & cInt(rst3(&quot;CategoryID&quot;)))
                                                        Else
                                                                Set rst4 = cnn.Execute(&quot;select count(*) as cnt from tblproduct&quot;)
                                                        End If
                                                        If rst4(&quot;cnt&quot;) > 0 Then
                                                                Flag = True
                                                                FlagTrueCount = FlagTrueCount + 1
                                                                If PrintedFlag = False Then
                                                                        %>
                                                                                <tr>
                                                                                        <td>
                                                                                                  
                                                                                        </td>
                                                                                        <td>
                                                                                                <img width=&quot;13&quot; src=&quot;images/<%=rst1(&quot;Categoryid&quot;)%>.gif&quot;>
                                                                                        </td>
                                                                                        <td>
                                                                                                <font face=&quot;Arial, Helvetica, sans-serif&quot; color=&quot;&quot; size=&quot;2&quot;>
                                                                                                        <b><%= uCase(rst1(&quot;CategoryName&quot;)) %></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=&quot;Subcategorynp.asp?ID=<%= rst2(&quot;ParentID&quot;) %>&CatID=<%= rst2(&quot;CategoryID&quot;) %>&quot;>
                                                                                        <font face=&quot;Arial, Helvetica, sans-serif&quot; color=&quot;#666666&quot; size=&quot;1&quot;>
                                                                                                <b><%= uCase(rst2(&quot;CategoryName&quot;)) %></b>
                                                                                        </font>
                                                                                </a>
                                                                        </td>
                                                                </tr>
                                                        <%
                                                                PrintedFlag = True
'                                                               Exit Do
                                                End If
                                                rst2.MoveNext
                                        Loop
                                rst1.MoveNext
                                %>
<!--
                                        <tr>
                                                <td colspan=&quot;3&quot;>
                                                         
                                                </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(&quot;select * from categories where parentID=0  order by sequence&quot;)
                If Not rst1.EOF Then
                        Do Until rst1.EOF
                                %>
                                        <tr>
                                                <td>
                                                          
                                                </td>
                                                <td>
                                                        <img width=&quot;13&quot; src=&quot;images/<%=rst1(&quot;Categoryid&quot;)%>.gif&quot;>
                                                </td>
                                                <td>
                                                        <font face=&quot;Arial, Helvetica, sans-serif&quot; color=&quot;&quot; size=&quot;2&quot;>
                                                                <b><%= uCase(rst1(&quot;CategoryName&quot;)) %></b>
                                                        </font>
                                                </td>
                                        </tr>
                                <%
                                Set rst2 = cnn.Execute(&quot;select * from categories where parentID=&quot; & cInt(rst1(&quot;CategoryID&quot;)) & &quot;  order by sequence&quot;)
                                        Do While NOT rst2.EOF
                                                %>
                                                        <tr>
                                                                <td>
                                                                </td>
                                                                <td>
                                                                </td>
                                                                <td>
                                                                       
                                                                        <a href=&quot;Subcategorynp.asp?ID=<%= rst2(&quot;ParentID&quot;) %>&CatID=<%= rst2(&quot;CategoryID&quot;) %>&quot;>
                                                                                <font face=&quot;Arial, Helvetica, sans-serif&quot; color=&quot;#666666&quot; size=&quot;1&quot;>
                                                                                        <b><%= uCase(rst2(&quot;CategoryName&quot;)) %></b>
                                                                                </font>
                                                                        </a>
                                                                </td>
                                                        </tr>
                                                <%
                                                rst2.MoveNext
                                        Loop
                                rst1.MoveNext
                                %>
                                        <tr>
                                                <td colspan=&quot;3&quot;>
                                                         
                                                </td>
                                        </tr>

                                <%
                        Loop
                End If
        End If

  %>

Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top