error if db search finds nothing

Discussion in 'ASP General' started by abbylee26@hotmail.com, Feb 22, 2006.

  1. Guest

    my page works fine if the db search finds at least one record that
    satifies the query.
    but if it does not find a match I get the following error message.

    Error Type:
    ADODB.Field (0x80020009)
    Either BOF or EOF is True, or the current record has been deleted.
    Requested operation requires a current record.

    What do I need to change here to make this just display the page with
    no data?

    sSQL = "SELECT [Billing Date], [Service Number], [Subscriber User
    Name]," & _
    " Fund, Account,[Activity Code], Description, [Total Charge]" & _
    " FROM 06_Statements" & _
    " WHERE [Billing Date] = '" & Request.Form("cmonth") & "'" & _
    " AND [Service Number] = '" & Request.Form("cnumb") & "'" & _
    " AND cstr([Total Charge]) = '" & cstr(Request.Form("camount")) & "'"
    set rs = Connect.Execute(sSQL)

    <%
    Do until rs.eof
    %>
    <tr>
    <td><%=rs("Service Number")%></td>
    <td><%=rs("Subscriber User Name")%></td>
    <td><%=rs("Fund")%></td>
    <td><%=rs("Account")%></td>
    <td><%=rs("Activity Code")%></td>
    <td><%=rs("Description")%></td>
    <td><%=rs("Total Charge")%></td>
    </tr>
    <% End If
    rs.MoveNext
    Loop %>
    , Feb 22, 2006
    #1
    1. Advertising

  2. Paxton Guest

    wrote:
    > my page works fine if the db search finds at least one record that
    > satifies the query.
    > but if it does not find a match I get the following error message.
    >
    > Error Type:
    > ADODB.Field (0x80020009)
    > Either BOF or EOF is True, or the current record has been deleted.
    > Requested operation requires a current record.
    >
    > What do I need to change here to make this just display the page with
    > no data?
    >
    > sSQL = "SELECT [Billing Date], [Service Number], [Subscriber User
    > Name]," & _
    > " Fund, Account,[Activity Code], Description, [Total Charge]" & _
    > " FROM 06_Statements" & _
    > " WHERE [Billing Date] = '" & Request.Form("cmonth") & "'" & _
    > " AND [Service Number] = '" & Request.Form("cnumb") & "'" & _
    > " AND cstr([Total Charge]) = '" & cstr(Request.Form("camount")) & "'"
    > set rs = Connect.Execute(sSQL)
    >
    > <%
    > Do until rs.eof
    > %>
    > <tr>
    > <td><%=rs("Service Number")%></td>
    > <td><%=rs("Subscriber User Name")%></td>
    > <td><%=rs("Fund")%></td>
    > <td><%=rs("Account")%></td>
    > <td><%=rs("Activity Code")%></td>
    > <td><%=rs("Description")%></td>
    > <td><%=rs("Total Charge")%></td>
    > </tr>
    > <% End If
    > rs.MoveNext
    > Loop %>


    If not rs.eof then
    Do until rs.eof
    %>
    <tr>
    <td><%=rs("Service Number")%></td>
    <td><%=rs("Subscriber User Name")%></td>
    <td><%=rs("Fund")%></td>
    <td><%=rs("Account")%></td>
    <td><%=rs("Activity Code")%></td>
    <td><%=rs("Description")%></td>
    <td><%=rs("Total Charge")%></td>
    </tr>
    <% End If
    rs.MoveNext
    Loop
    Else
    response.write "No records to show"
    End If
    %>

    /P.
    Paxton, Feb 22, 2006
    #2
    1. Advertising

  3. Paxton Guest

    Paxton wrote:
    > wrote:
    > > my page works fine if the db search finds at least one record that
    > > satifies the query.
    > > but if it does not find a match I get the following error message.
    > >
    > > Error Type:
    > > ADODB.Field (0x80020009)
    > > Either BOF or EOF is True, or the current record has been deleted.
    > > Requested operation requires a current record.
    > >
    > > What do I need to change here to make this just display the page with
    > > no data?
    > >
    > > sSQL = "SELECT [Billing Date], [Service Number], [Subscriber User
    > > Name]," & _
    > > " Fund, Account,[Activity Code], Description, [Total Charge]" & _
    > > " FROM 06_Statements" & _
    > > " WHERE [Billing Date] = '" & Request.Form("cmonth") & "'" & _
    > > " AND [Service Number] = '" & Request.Form("cnumb") & "'" & _
    > > " AND cstr([Total Charge]) = '" & cstr(Request.Form("camount")) & "'"
    > > set rs = Connect.Execute(sSQL)
    > >
    > > <%
    > > Do until rs.eof
    > > %>
    > > <tr>
    > > <td><%=rs("Service Number")%></td>
    > > <td><%=rs("Subscriber User Name")%></td>
    > > <td><%=rs("Fund")%></td>
    > > <td><%=rs("Account")%></td>
    > > <td><%=rs("Activity Code")%></td>
    > > <td><%=rs("Description")%></td>
    > > <td><%=rs("Total Charge")%></td>
    > > </tr>
    > > <% End If
    > > rs.MoveNext
    > > Loop %>

    >
    > If not rs.eof then
    > Do until rs.eof
    > %>
    > <tr>
    > <td><%=rs("Service Number")%></td>
    > <td><%=rs("Subscriber User Name")%></td>
    > <td><%=rs("Fund")%></td>
    > <td><%=rs("Account")%></td>
    > <td><%=rs("Activity Code")%></td>
    > <td><%=rs("Description")%></td>
    > <td><%=rs("Total Charge")%></td>
    > </tr>
    > <% End If
    > rs.MoveNext
    > Loop
    > Else
    > response.write "No records to show"
    > End If
    > %>
    >
    > /P.


    Oops. I didn't spot an odd 'End If' already in your code - just before
    rs.movenext. You need to remove that - it serves no purpose that I can
    see in the snippet.

    /P.
    Paxton, Feb 22, 2006
    #3
  4. Guest

    that didn't work even after I removed my "End If"
    I got the error:
    Error Type:
    Microsoft VBScript compilation (0x800A040E)
    'loop' without 'do'
    , Feb 22, 2006
    #4
  5. Paxton Guest

    wrote:
    > that didn't work even after I removed my "End If"
    > I got the error:
    > Error Type:
    > Microsoft VBScript compilation (0x800A040E)
    > 'loop' without 'do'


    What's your revised code?

    /P.
    Paxton, Feb 22, 2006
    #5
  6. Guest

    If not rs.eof then
    Do until rs.eof
    %>
    <tr>
    <td><%=rs("Service Number")%></td>
    <td><%=rs("Subscriber User Name")%></td>
    <td><%=rs("Fund")%></td>
    <td><%=rs("Account")%></td>
    <td><%=rs("Activity Code")%></td>
    <td><%=rs("Description")%></td>
    <td><%=rs("Total Charge")%></td>
    </tr>
    <%
    rs.MoveNext
    Loop
    Else
    response.write "No records to show"
    End If
    %>


    I still get the
    Error Type:
    Microsoft VBScript compilation (0x800A040E)
    'loop' without 'do'
    , Feb 22, 2006
    #6
  7. Paxton Guest

    wrote in news:1140642626.234880.326860
    @g14g2000cwa.googlegroups.com:

    > If not rs.eof then
    > Do until rs.eof
    > %>
    > <tr>
    > <td><%=rs("Service Number")%></td>
    > <td><%=rs("Subscriber User Name")%></td>
    > <td><%=rs("Fund")%></td>
    > <td><%=rs("Account")%></td>
    > <td><%=rs("Activity Code")%></td>
    > <td><%=rs("Description")%></td>
    > <td><%=rs("Total Charge")%></td>
    > </tr>
    > <%
    > rs.MoveNext
    > Loop
    > Else
    > response.write "No records to show"
    > End If
    > %>
    >
    >
    > I still get the
    > Error Type:
    > Microsoft VBScript compilation (0x800A040E)
    > 'loop' without 'do'
    >
    >


    I think we need more of your code. There's something else going on. It
    could be that the End If you removed closed an if statement you started
    somewhere else, although the original position of it is strange. Could you
    post all of it?

    /P.
    Paxton, Feb 22, 2006
    #7
  8. Guest

    Wait...I've been cutting everything I didn't think was really part of
    the code. Here's the full thing.

    <%
    Dim sBackgroundColor
    sBackgroundColor = "#ffffff"

    If not rs.eof then
    Do until rs.eof

    If rs("Service Number") <> "" Then
    If sBackgroundColor = "#ffffff" Then
    sBackgroundColor = "#f7f7f7"
    Else
    sBackgroundColor = "#ffffff"
    End If
    %>
    <tr bgcolor="<%=sBackgroundColor%>">
    <td class="pagefont"><%=rs("Service Number")%></td>
    <td class="pagefont"><%=rs("Subscriber User Name")%></td>
    <td class="pagefont"><div align="center"><%=rs("Fund")%></div></td>
    <td class="pagefont"><div
    align="center"><%=rs("Account")%></div></td>
    <td class="pagefont"><div align="center"><%=rs("Activity
    Code")%></div></td>
    <td class="pagefont"><%=rs("Description")%></td>
    <td class="pagefont"><div align="center"><%=rs("Total
    Charge")%></div></td>
    </tr>
    <%
    End If
    rs.MoveNext
    Loop
    End If
    %>
    , Feb 22, 2006
    #8
  9. Paxton Guest

    wrote in news:1140643867.672604.95680
    @g14g2000cwa.googlegroups.com:

    > Wait...I've been cutting everything I didn't think was really part of
    > the code. Here's the full thing.
    >
    > <%
    > Dim sBackgroundColor
    > sBackgroundColor = "#ffffff"
    >
    > If not rs.eof then
    > Do until rs.eof
    >
    > If rs("Service Number") <> "" Then
    > If sBackgroundColor = "#ffffff" Then
    > sBackgroundColor = "#f7f7f7"
    > Else
    > sBackgroundColor = "#ffffff"
    > End If
    > %>
    > <tr bgcolor="<%=sBackgroundColor%>">
    > <td class="pagefont"><%=rs("Service Number")%></td>
    > <td class="pagefont"><%=rs("Subscriber User Name")%></td>
    > <td class="pagefont"><div align="center"><%=rs("Fund")%></div></td>
    > <td class="pagefont"><div
    > align="center"><%=rs("Account")%></div></td>
    > <td class="pagefont"><div align="center"><%=rs("Activity
    > Code")%></div></td>
    > <td class="pagefont"><%=rs("Description")%></td>
    > <td class="pagefont"><div align="center"><%=rs("Total
    > Charge")%></div></td>
    > </tr>
    > <%
    > End If
    > rs.MoveNext
    > Loop
    > End If
    > %>
    >
    >


    The errant End If, before rs.movenext needs to be moved under 'Loop'. so
    the last 5 lines will be

    <%
    rs.Movenext
    Loop
    End if
    End if

    Incidentally, your logic concerning the backgound colour will always result
    in a back ground with '#f7f7f7'.

    /P.
    Paxton, Feb 22, 2006
    #9
  10. Paxton Guest

    Paxton <> wrote in
    news:Xns9772DC0AE767mytokenM@195.188.240.200:

    > wrote in news:1140643867.672604.95680
    > @g14g2000cwa.googlegroups.com:
    >
    >> Wait...I've been cutting everything I didn't think was really part of
    >> the code. Here's the full thing.
    >>
    >> <%
    >> Dim sBackgroundColor
    >> sBackgroundColor = "#ffffff"
    >>
    >> If not rs.eof then
    >> Do until rs.eof
    >>
    >> If rs("Service Number") <> "" Then
    >> If sBackgroundColor = "#ffffff" Then
    >> sBackgroundColor = "#f7f7f7"
    >> Else
    >> sBackgroundColor = "#ffffff"
    >> End If
    >> %>
    >> <tr bgcolor="<%=sBackgroundColor%>">
    >> <td class="pagefont"><%=rs("Service Number")%></td>
    >> <td class="pagefont"><%=rs("Subscriber User Name")%></td>
    >> <td class="pagefont"><div
    >> align="center"><%=rs("Fund")%></div></td> <td
    >> class="pagefont"><div
    >> align="center"><%=rs("Account")%></div></td>
    >> <td class="pagefont"><div align="center"><%=rs("Activity
    >> Code")%></div></td>
    >> <td class="pagefont"><%=rs("Description")%></td>
    >> <td class="pagefont"><div align="center"><%=rs("Total
    >> Charge")%></div></td>
    >> </tr>
    >> <%
    >> End If
    >> rs.MoveNext
    >> Loop
    >> End If
    >> %>
    >>
    >>

    >
    > The errant End If, before rs.movenext needs to be moved under 'Loop'.
    > so the last 5 lines will be
    >
    > <%
    > rs.Movenext
    > Loop
    > End if
    > End if
    >


    Or... depending on what condition you are using to change the background
    colour, that End If might belong further up:

    If rs("Service Number") <> "" Then
    If sBackgroundColor = "#ffffff" Then
    sBackgroundColor = "#f7f7f7"
    Else
    sBackgroundColor = "#ffffff"
    End If
    End If <--- here

    but your background will still always be grey. You set it to white
    earlier on, then you code says, if it's white (which it is) then change
    it to grey, otherwise make it white. The otherwise part of the code
    will never be run.

    /P.
    Paxton, Feb 22, 2006
    #10
  11. Guest

    <%
    rs.Movenext
    Loop
    End if
    End if

    I still get the
    Error Type:
    Microsoft VBScript compilation (0x800A040E)
    'loop' without 'do'

    My background works good every other line is white, gray...always
    starting with white.
    , Feb 22, 2006
    #11
  12. Guest

    I will try this in the morning...thanks
    , Feb 22, 2006
    #12
  13. Paxton Guest

    wrote in news:1140645063.400561.61390
    @f14g2000cwb.googlegroups.com:

    > I will try this in the morning...thanks
    >


    If you still have problems, post the code for the whole page. There's more
    going on than the selected snippets you've shown so far.

    /P.
    Paxton, Feb 22, 2006
    #13
  14. dNagel Guest

    I believe the correct logic for recordsets is to use

    While Not (rs.BOF or rs.EOF)
    ...
    rs.movenext
    Wend

    D.


    Paxton wrote:
    > wrote in news:1140645063.400561.61390
    > @f14g2000cwb.googlegroups.com:
    >
    >
    >>I will try this in the morning...thanks
    >>

    >
    >
    > If you still have problems, post the code for the whole page. There's more
    > going on than the selected snippets you've shown so far.
    >
    > /P.
    dNagel, Feb 23, 2006
    #14
  15. Paxton Guest

    dNagel wrote:
    > I believe the correct logic for recordsets is to use
    >
    > While Not (rs.BOF or rs.EOF)
    > ...
    > rs.movenext
    > Wend
    >


    Neither correct or incorrect - just another alternative looping
    structure - although the VBScript reference material provided by
    Microsoft recommends the use of do... loop over while... wend

    http://msdn.microsoft.com/library/d...html/992f38a7-6cb3-4bc6-a70a-a56c7d54ed17.asp

    Personally, with recordsets, I always use GetRows() and For... Next.

    /P.
    Paxton, Feb 23, 2006
    #15
  16. Guest

    The code is still having problems. If the number 0.05 is in the db and
    I search for either 0.05 or .05 I get all records with that number. If
    0.05 is not in the db I get the error message Error Type:
    ADODB.Field (0x80020009)
    Either BOF or EOF is True, or the current record has been deleted.
    Requested operation requires a current record.

    Here is my full code:

    <!--#include file="include.asp" -->
    <%
    Dim connect, rs
    Dim sSQL

    Set connect = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateOBject("ADODB.Recordset")
    connect.ConnectionString = _
    "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & sTelecom
    connect.open
    %>
    <%
    Dim TheAmount
    Set TheAmount = Request.Form("thefield")

    sSQL = "SELECT [Billing Date], [Service Number], [Subscriber User
    Name]," & _
    " Fund, Account,[Activity Code], Description, [Total Charge]" & _
    " FROM 06_Statements" & _
    " WHERE [Billing Date] = '" & Request.Form("cmonth") & "'" & _
    " AND [Service Number] = '" & Request.Form("cnumb") & "'" & _
    " AND CDbl([Total Charge]) = '" & CDbl(Request.Form("camount")) & "'"

    set rs = Connect.Execute(sSQL)

    End If
    %>

    <html>
    <head>
    <title>Untitled Document</title>
    <link href="../../documents.css" rel="stylesheet" type="text/css">
    </head>

    <body bgcolor="#ffffff">
    <table border="0" align="center" cellpadding="2" cellspacing="0">
    <tr>
    <td colspan="7"><div align="center" class="menuHeader"><font
    color="#FF0000">Statements</font></div></td>
    </tr>
    <tr>
    <td class="menuHeader2">Billing Date</td>
    <td class="menuHeader2" colspan="6"><%=rs("Billing Date")%></td>
    </tr>
    <tr>
    <td colspan="7">&nbsp;</td>
    </tr>
    <tr>
    <td height="20" width="60"> <nobr>
    <div class="menuHeader2">Service Number &nbsp;</div>
    </nobr></td>
    <td width="60"> <nobr><div class="menuHeader2">Subscriber User
    Name</div></nobr></td>
    <td width="60"> <div class="menuHeader2">
    <div align="center">Fund</div>
    </div></td>
    <td width="30"> <div class="menuHeader2">Account</div></td>
    <td width="60"> <div class="menuHeader2">
    <div align="center">Activity</div>
    </div></td>
    <td width="60"> <div class="menuHeader2">Description</div></td>
    <td width="60"> <div class="menuHeader2">Amount</div></td>
    </tr>
    <%
    Dim sBackgroundColor
    sBackgroundColor = "#ffffff"

    If not rs.eof then
    Do until rs.eof

    If rs("Service Number") <> "" Then
    If sBackgroundColor = "#ffffff" Then
    sBackgroundColor = "#f7f7f7"
    Else
    sBackgroundColor = "#ffffff"
    End If
    End If
    %>
    <tr bgcolor="<%=sBackgroundColor%>">
    <td class="pagefont"><%=rs("Service Number")%></td>
    <td class="pagefont"><%=rs("Subscriber User Name")%></td>
    <td class="pagefont"><div align="center"><%=rs("Fund")%></div></td>
    <td class="pagefont"><div
    align="center"><%=rs("Account")%></div></td>
    <td class="pagefont"><div align="center"><%=rs("Activity
    Code")%></div></td>
    <td class="pagefont"><%=rs("Description")%></td>
    <td class="pagefont"><div align="center"><%=rs("Total
    Charge")%></div></td>
    </tr>
    <%
    rs.MoveNext
    Loop
    End If
    %>
    </table>
    </body>
    </html>
    , Feb 23, 2006
    #16
  17. dNagel Guest

    You need to check for EOF or BOF... you're only checking for EOF...

    Do while not (rs.eof or rs.bof)

    D.


    wrote:
    > The code is still having problems. If the number 0.05 is in the db and
    > I search for either 0.05 or .05 I get all records with that number. If
    > 0.05 is not in the db I get the error message Error Type:
    > ADODB.Field (0x80020009)
    > Either BOF or EOF is True, or the current record has been deleted.
    > Requested operation requires a current record.
    >
    > Here is my full code:
    >
    > <!--#include file="include.asp" -->
    > <%
    > Dim connect, rs
    > Dim sSQL
    >
    > Set connect = Server.CreateObject("ADODB.Connection")
    > Set rs = Server.CreateOBject("ADODB.Recordset")
    > connect.ConnectionString = _
    > "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    > "Data Source=" & sTelecom
    > connect.open
    > %>
    > <%
    > Dim TheAmount
    > Set TheAmount = Request.Form("thefield")
    >
    > sSQL = "SELECT [Billing Date], [Service Number], [Subscriber User
    > Name]," & _
    > " Fund, Account,[Activity Code], Description, [Total Charge]" & _
    > " FROM 06_Statements" & _
    > " WHERE [Billing Date] = '" & Request.Form("cmonth") & "'" & _
    > " AND [Service Number] = '" & Request.Form("cnumb") & "'" & _
    > " AND CDbl([Total Charge]) = '" & CDbl(Request.Form("camount")) & "'"
    >
    > set rs = Connect.Execute(sSQL)
    >
    > End If
    > %>
    >
    > <html>
    > <head>
    > <title>Untitled Document</title>
    > <link href="../../documents.css" rel="stylesheet" type="text/css">
    > </head>
    >
    > <body bgcolor="#ffffff">
    > <table border="0" align="center" cellpadding="2" cellspacing="0">
    > <tr>
    > <td colspan="7"><div align="center" class="menuHeader"><font
    > color="#FF0000">Statements</font></div></td>
    > </tr>
    > <tr>
    > <td class="menuHeader2">Billing Date</td>
    > <td class="menuHeader2" colspan="6"><%=rs("Billing Date")%></td>
    > </tr>
    > <tr>
    > <td colspan="7">&nbsp;</td>
    > </tr>
    > <tr>
    > <td height="20" width="60"> <nobr>
    > <div class="menuHeader2">Service Number &nbsp;</div>
    > </nobr></td>
    > <td width="60"> <nobr><div class="menuHeader2">Subscriber User
    > Name</div></nobr></td>
    > <td width="60"> <div class="menuHeader2">
    > <div align="center">Fund</div>
    > </div></td>
    > <td width="30"> <div class="menuHeader2">Account</div></td>
    > <td width="60"> <div class="menuHeader2">
    > <div align="center">Activity</div>
    > </div></td>
    > <td width="60"> <div class="menuHeader2">Description</div></td>
    > <td width="60"> <div class="menuHeader2">Amount</div></td>
    > </tr>
    > <%
    > Dim sBackgroundColor
    > sBackgroundColor = "#ffffff"
    >
    > If not rs.eof then
    > Do until rs.eof
    >
    > If rs("Service Number") <> "" Then
    > If sBackgroundColor = "#ffffff" Then
    > sBackgroundColor = "#f7f7f7"
    > Else
    > sBackgroundColor = "#ffffff"
    > End If
    > End If
    > %>
    > <tr bgcolor="<%=sBackgroundColor%>">
    > <td class="pagefont"><%=rs("Service Number")%></td>
    > <td class="pagefont"><%=rs("Subscriber User Name")%></td>
    > <td class="pagefont"><div align="center"><%=rs("Fund")%></div></td>
    > <td class="pagefont"><div
    > align="center"><%=rs("Account")%></div></td>
    > <td class="pagefont"><div align="center"><%=rs("Activity
    > Code")%></div></td>
    > <td class="pagefont"><%=rs("Description")%></td>
    > <td class="pagefont"><div align="center"><%=rs("Total
    > Charge")%></div></td>
    > </tr>
    > <%
    > rs.MoveNext
    > Loop
    > End If
    > %>
    > </table>
    > </body>
    > </html>
    >
    dNagel, Feb 23, 2006
    #17
  18. This is usually not necessary in an ASP page.
    In a VB application where you are likely to be navigating both forward and
    backward, yes, it is a good idea to check both. In a forward-only recordset,
    which is the default, I cannot think of a case where it is necessary to
    check BOF.

    I strongly suspect the OP's query is not retrieving any records.

    Bob Barrows
    dNagel wrote:
    > You need to check for EOF or BOF... you're only checking for EOF...
    >
    > Do while not (rs.eof or rs.bof)
    >
    > D.
    >
    >
    > wrote:
    >> The code is still having problems. If the number 0.05 is in the db
    >> and I search for either 0.05 or .05 I get all records with that
    >> number. If
    >> 0.05 is not in the db I get the error message Error Type:
    >> ADODB.Field (0x80020009)
    >> Either BOF or EOF is True, or the current record has been deleted.
    >> Requested operation requires a current record.
    >>
    >> Here is my full code:
    >>
    >> <!--#include file="include.asp" -->
    >> <%
    >> Dim connect, rs
    >> Dim sSQL
    >>
    >> Set connect = Server.CreateObject("ADODB.Connection")
    >> Set rs = Server.CreateOBject("ADODB.Recordset")
    >> connect.ConnectionString = _
    >> "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    >> "Data Source=" & sTelecom
    >> connect.open
    >> %>
    >> <%
    >> Dim TheAmount
    >> Set TheAmount = Request.Form("thefield")
    >>
    >> sSQL = "SELECT [Billing Date], [Service Number], [Subscriber User
    >> Name]," & _
    >> " Fund, Account,[Activity Code], Description, [Total Charge]" & _
    >> " FROM 06_Statements" & _
    >> " WHERE [Billing Date] = '" & Request.Form("cmonth") & "'" & _
    >> " AND [Service Number] = '" & Request.Form("cnumb") & "'" & _
    >> " AND CDbl([Total Charge]) = '" & CDbl(Request.Form("camount")) &
    >> "'"
    >>
    >> set rs = Connect.Execute(sSQL)
    >>
    >> End If
    >> %>
    >>
    >> <html>
    >> <head>
    >> <title>Untitled Document</title>
    >> <link href="../../documents.css" rel="stylesheet" type="text/css">
    >> </head>
    >>
    >> <body bgcolor="#ffffff">
    >> <table border="0" align="center" cellpadding="2" cellspacing="0">
    >> <tr>
    >> <td colspan="7"><div align="center" class="menuHeader"><font
    >> color="#FF0000">Statements</font></div></td>
    >> </tr>
    >> <tr>
    >> <td class="menuHeader2">Billing Date</td>
    >> <td class="menuHeader2" colspan="6"><%=rs("Billing Date")%></td>
    >> </tr>
    >> <tr>
    >> <td colspan="7">&nbsp;</td>
    >> </tr>
    >> <tr>
    >> <td height="20" width="60"> <nobr>
    >> <div class="menuHeader2">Service Number &nbsp;</div>
    >> </nobr></td>
    >> <td width="60"> <nobr><div class="menuHeader2">Subscriber User
    >> Name</div></nobr></td>
    >> <td width="60"> <div class="menuHeader2">
    >> <div align="center">Fund</div>
    >> </div></td>
    >> <td width="30"> <div class="menuHeader2">Account</div></td>
    >> <td width="60"> <div class="menuHeader2">
    >> <div align="center">Activity</div>
    >> </div></td>
    >> <td width="60"> <div class="menuHeader2">Description</div></td>
    >> <td width="60"> <div class="menuHeader2">Amount</div></td>
    >> </tr>
    >> <%
    >> Dim sBackgroundColor
    >> sBackgroundColor = "#ffffff"
    >>
    >> If not rs.eof then
    >> Do until rs.eof
    >>
    >> If rs("Service Number") <> "" Then
    >> If sBackgroundColor = "#ffffff" Then
    >> sBackgroundColor = "#f7f7f7"
    >> Else
    >> sBackgroundColor = "#ffffff"
    >> End If
    >> End If
    >> %>
    >> <tr bgcolor="<%=sBackgroundColor%>">
    >> <td class="pagefont"><%=rs("Service Number")%></td>
    >> <td class="pagefont"><%=rs("Subscriber User Name")%></td>
    >> <td class="pagefont"><div
    >> align="center"><%=rs("Fund")%></div></td> <td
    >> class="pagefont"><div
    >> align="center"><%=rs("Account")%></div></td>
    >> <td class="pagefont"><div align="center"><%=rs("Activity
    >> Code")%></div></td>
    >> <td class="pagefont"><%=rs("Description")%></td>
    >> <td class="pagefont"><div align="center"><%=rs("Total
    >> Charge")%></div></td>
    >> </tr>
    >> <%
    >> rs.MoveNext
    >> Loop
    >> End If
    >> %>
    >> </table>
    >> </body>
    >> </html>


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Feb 23, 2006
    #18
  19. Guest

    Yes, only when there are no records to report am I getting the error
    message.
    I need the page to come up but empty. or maybe a message "sorry no
    records"
    , Feb 23, 2006
    #19
  20. dNagel Guest

    Bob Barrows [MVP] wrote:
    > This is usually not necessary in an ASP page.
    > In a VB application where you are likely to be navigating both forward and
    > backward, yes, it is a good idea to check both. In a forward-only recordset,
    > which is the default, I cannot think of a case where it is necessary to
    > check BOF.
    >
    > I strongly suspect the OP's query is not retrieving any records.


    Which is why it's necessary to check BOF... BOF AND EOF are true when theres
    an empty recordset.

    D.
    dNagel, Feb 23, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Verstraete
    Replies:
    1
    Views:
    549
    Mike Treseler
    Sep 12, 2005
  2. Alan Silver
    Replies:
    2
    Views:
    11,026
    Alan Silver
    Jul 19, 2005
  3. Alan Silver
    Replies:
    9
    Views:
    22,524
    aspbgt
    Nov 5, 2007
  4. Jerry
    Replies:
    11
    Views:
    1,135
    Chris Uppal
    Mar 30, 2006
  5. Devin Jeanpierre
    Replies:
    2
    Views:
    427
    Devin Jeanpierre
    Feb 14, 2012
Loading...

Share This Page