Please help with IF EOF TRUE

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Please help with IF EOF TRUE

    Hello,
    I am stuck with EOF TRUE error and not quite sure what I did wrong:
    Here is code:
    ************************************************** **************************
    ****
    <%Response.Buffer=TRUE%>
    <%IF session("admin") = FALSE THEN Response.Redirect "admin.asp"%>

    <%
    tbl = Request.QueryString("which")
    If tbl = "users" Then
    ttl = "Users"
    Else
    ttl = "Administrators"
    End If
    %>

    <html>

    <head>
    <title>Delete <%=ttl%></title>
    </head>


    <body vlink="#FFFFCC" alink="#FFFF00" link="#FFFFFF">

    <div align="center">
    <table border="1" cellspacing="4" width="657" height="543" cellpadding="2">
    <!-- MSTableType="layout" -->
    <tr>
    <td valign="top" colspan="2" height="74" bgcolor="#660066">
    <!-- MSCellType="ContentHead" -->
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse:
    collapse" width="100%" id="table8">
    <tr>
    <td>
    <p align="center"><font color="#FFFFFF" face="Verdana"><b>
    <img border="0" src="../images/users.gif" width="32"
    height="32"></b></font></td>
    <td>
    <p align="center"><font color="#FFFFFF"><b>USER MANAGER</b></font></td>
    <td>
    <p align="center"><font color="#FFFFFF" face="Verdana"><b>
    <img border="0" src="../images/key.gif" width="32"
    height="32"></b></font></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td msopnltype="NavBody" rowspan="2" width="113" valign="top"
    bgcolor="#660066">
    <!-- MSCellType="NavBody" -->
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse:
    collapse" width="100%" id="table7">
    <tr>
    <td align="center">
    <p align="center">
    <b><font size="2"><a
    href="javascript:history.back(1)">HOME</a></font></b></td>
    </tr>
    </table>
    </td>
    <td valign="top" height="419">
    <!-- MSCellType="ContentBody" -->

    <%
    'here is the connection string
    Set conn = server.createobject("adodb.connection")
    'this connection uses JET 4 it is the prefered method of connecting to an
    access database
    DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.Mappath("/asplogin/login.mdb")
    'if you cant use JET then comment out the line above and uncomment the line
    below
    'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
    Server.Mappath("/asplogin/login.mdb")
    conn.Open DSNtemp

    SQL = "Select * from "& tbl
    pagetot = 10

    const adOpenForwardOnly = 0
    const adOpenKeySet = 1
    const adOpenDynamic = 2
    const adOpenStatic = 3
    const adLockReadOnly = 1
    const adLockPessimistic = 2
    const adLockOptimistic = 3
    const adLockBatchOptimistic = 4
    Set RS = Server.CreateObject("Adodb.RecordSet")
    RS.Open SQL, Conn, adopenkeyset, adlockoptimistic
    If RS.EOF Then
    %>
    <table cellspacing="1" border="0" cellpadding="2" width="100%">
    <tr>
    <td bgcolor="#CC0000">
    <p align="center">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    <font color="#FFFFFF">Sorry, no records were found. </font> <a
    href="javascript:history.back(1)">Back To
    <%=ttl%> Manager</a> </font></td>
    </tr>
    </table>
    <font face="Verdana, Arial, Helvetica, sans-serif"><font size="2">
    <%
    ElseIf request("begin") = "" Then
    begin = 1
    Else
    begin = Cint(request("begin"))
    End If

    tot = ((begin+pagetot)-1)

    If tot > RS.RecordCount Then
    tot = RS.RecordCount
    End If

    i = 1
    navi = ""
    For j = 1 to RS.RecordCount step pagetot
    If j <> 1 Then navi = navi & " | "
    If j = Cint(begin) Then
    navi = navi & "<b>"&i&"</b>"
    Else
    navi = navi & "<a href="""
    navi = navi & Request.ServerVariables("url") & "?begin=" & j &
    "&which=" & tbl
    navi = navi & """>"
    navi = navi & i & "</a>"
    End If
    i = i + 1
    Next
    i = 1
    RS.Move begin - 1
    %> </font>
    <p align="center"><b><font size="4">Delete <%=ttl%></font></b></p>
    </font>


    <%
    For x = begin to begin + (pagetot - 1)
    If RS.EOF Then exit For
    %>
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse:
    collapse" width="100%" id="table1" bgcolor="#FFFFDD">
    <tr>
    <td><font face="Verdana" size="2">User Name:</font></td>
    <td><font face="Verdana" size="2"><%=RS("uid")%></font></td>
    <td><font face="Verdana" size="2">Address:</font></td>
    <td><font face="Verdana" size="2"><%=RS("Address")%></font></td>
    </tr>
    <tr>
    <td><font face="Verdana" size="2">Password:</font></td>
    <td><font face="Verdana" size="2"><%=RS("pwd")%></font></td>
    <td><font face="Verdana" size="2">ZIP Code:</font></td>
    <td><font face="Verdana" size="2"><%=RS("ZIP")%></font></td>
    </tr>
    <tr>
    <td><font face="Verdana" size="2">First Name:</font></td>
    <td><font face="Verdana" size="2"><%=RS("FirstName")%></font></td>
    <td><font face="Verdana" size="2">City:</font></td>
    <td><font face="Verdana" size="2"><%=RS("City")%></font></td>
    </tr>
    <tr>
    <td><font face="Verdana" size="2">Last Name:</font></td>
    <td><font face="Verdana" size="2"><%=RS("LastName")%></font></td>
    <td><font face="Verdana" size="2">Country:</font></td>
    <td><font face="Verdana" size="2"><%=RS("Country")%></font></td>
    </tr>
    <tr>
    <td><font face="Verdana" size="2">Phone:</font></td>
    <td><font face="Verdana" size="2"><%=RS("PhoneNumber")%></font></td>
    <td><font face="Verdana" size="2">Mobile:</font></td>
    <td><font face="Verdana" size="2"><%=RS("MobileNumber")%></font></td>
    </tr>
    <tr>
    <td><font face="Verdana" size="2">Fax:</font></td>
    <td><font face="Verdana" size="2"><%=RS("Fax")%></font></td>
    <td><font face="Verdana" size="2">Notes:</font></td>
    <td><font face="Verdana" size="2"><%=RS("Notes")%></font></td>
    </tr>
    <tr>
    <td colspan="4">
    <p align="center">
    <a href="delete2.asp?which=<%=tbl%>&id=<%=RS("id")%>" >
    <img border="0" src="../images/btn_delete.gif" width="70"
    height="30"></a></td>
    </tr>
    <tr>
    <td colspan="4" bgcolor="#000000">&nbsp;</td>
    </tr>
    </table>
    <%
    i = i + 1
    RS.MoveNext
    Next
    %>
    <table cellspacing="2" cellpadding="2" width="100%">
    <tr>
    <td align="right">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    <b><%=ttl%> <%=begin%>
    - <%=tot%> of <%=RS.RecordCount%> Page:</b> <%=navi%> </font>
    </td>
    </tr>
    </table>
    <p>&nbsp;</p>
    <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%
    RS.Close
    Set RS = nothing
    Conn.close
    Set Conn = Nothing
    %> </font>
    </td>
    </tr>
    <tr>
    <td valign="top" height="50" width="544" bgcolor="#660066">
    <!-- MSCellType="ContentFoot" -->
    <p align="center"><font size="2" face="Verdana">
    </td>
    </tr>
    </table>
    </div>

    </body>

    </html>
    ************************************************** '''
    Thank you....

    /Goran


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.524 / Virus Database: 321 - Release Date: 06.10.2003


    Goran Guest

  2. Similar Questions and Discussions

    1. #26232 [Opn->Bgs]: in_array produces true when bool true is in haystack
      ID: 26232 Updated by: jay@php.net Reported By: me at my dot house -Status: Open +Status: Bogus Bug...
    2. #26232 [Bgs->Opn]: in_array produces true when bool true is in haystack
      ID: 26232 Updated by: helly@php.net Reported By: me at my dot house -Status: Bogus +Status: Open...
    3. #26232 [Ver->Bgs]: in_array produces true when bool true is in haystack
      ID: 26232 Updated by: iliaa@php.net Reported By: me at my dot house -Status: Verified +Status: Bogus...
    4. #26232 [Ver]: in_array produces true when bool true is in haystack
      ID: 26232 Updated by: jay@php.net Reported By: me at my dot house Status: Verified Bug Type: Arrays...
    5. #26232 [Opn->Ver]: in_array produces true when bool true is in haystack
      ID: 26232 Updated by: helly@php.net Reported By: me at my dot house -Status: Open +Status: Verified...
  3. #2

    Default Re: Please help with IF EOF TRUE

    Aaarghh! Why all the irrelevant html garbage???? You're having a problem
    with a vbscript statement! So show us the vbscript code!
    Goran wrote:
    > Hello,
    > I am stuck with EOF TRUE error and not quite sure what I did wrong:
    > Here is code:
    >
    ************************************************** **************************
    > ****
    <snip>
    > 'here is the connection string
    > Set conn = server.createobject("adodb.connection")
    > 'this connection uses JET 4 it is the prefered method of connecting
    > to an access database
    > DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > Server.Mappath("/asplogin/login.mdb")
    > 'if you cant use JET then comment out the line above and uncomment
    > the line below
    > 'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
    > Server.Mappath("/asplogin/login.mdb")
    > conn.Open DSNtemp
    >
    > SQL = "Select * from "& tbl
    Bad. Do not use "Select *" in production code. Always spell out the fields
    you want your query to return.
    > pagetot = 10
    >
    > const adOpenForwardOnly = 0
    > const adOpenKeySet = 1
    > const adOpenDynamic = 2
    > const adOpenStatic = 3
    > const adLockReadOnly = 1
    > const adLockPessimistic = 2
    > const adLockOptimistic = 3
    > const adLockBatchOptimistic = 4
    [url]http://www.aspfaq.com/show.asp?id=2112[/url]
    > Set RS = Server.CreateObject("Adodb.RecordSet")
    > RS.Open SQL, Conn, adopenkeyset, adlockoptimistic
    Bad. You are not planning on updating this particular recordset. Open a
    read-only, forward-only recordset. And tell ADO what your command type is:
    Const adCmdText = 1
    RS.Open SQL, Conn, ,,adCmdText

    > If RS.EOF Then
    > %>
    <snip of inefficient recordset loop>
    > ************************************************** '''
    > Thank you....
    >
    Ummm - did I miss something? What's the problem?

    Bob Barrows


    Bob Barrows Guest

  4. #3

    Default Re: Please help with IF EOF TRUE

    Just a hint for you: if you are having a problem with a small part of your
    code, strip out all the non-essential stuff (do it in a new page) and
    concentrate on getting it working without all the distractions.
    In other words, create a page that contains ONLY the server-side asp code
    from this page and concentrate on getting that working. Instead of all that
    html stuff, use a few response.write statments to help you debug it

    HTH,
    Bob Barrows

    Goran wrote:
    > Hello,
    > I am stuck with EOF TRUE error and not quite sure what I did wrong:
    > Here is code:
    >
    ************************************************** **************************
    > ****
    > <%Response.Buffer=TRUE%>
    > <%IF session("admin") = FALSE THEN Response.Redirect "admin.asp"%>
    >
    > <%
    > tbl = Request.QueryString("which")
    > If tbl = "users" Then
    > ttl = "Users"
    > Else
    > ttl = "Administrators"
    > End If
    > %>
    >
    > <html>
    >
    > <head>
    > <title>Delete <%=ttl%></title>
    > </head>
    >
    >
    > <body vlink="#FFFFCC" alink="#FFFF00" link="#FFFFFF">
    >
    > <div align="center">
    > <table border="1" cellspacing="4" width="657" height="543"
    > cellpadding="2"> <!-- MSTableType="layout" -->
    > <tr>
    > <td valign="top" colspan="2" height="74" bgcolor="#660066">
    > <!-- MSCellType="ContentHead" -->
    > <table border="1" cellpadding="0" cellspacing="0"
    > style="border-collapse: collapse" width="100%" id="table8">
    > <tr>
    > <td>
    > <p align="center"><font color="#FFFFFF" face="Verdana"><b>
    > <img border="0" src="../images/users.gif" width="32"
    > height="32"></b></font></td>
    > <td>
    > <p align="center"><font color="#FFFFFF"><b>USER
    > MANAGER</b></font></td> <td>
    > <p align="center"><font color="#FFFFFF" face="Verdana"><b>
    > <img border="0" src="../images/key.gif" width="32"
    > height="32"></b></font></td>
    > </tr>
    > </table>
    > </td>
    > </tr>
    > <tr>
    > <td msopnltype="NavBody" rowspan="2" width="113" valign="top"
    > bgcolor="#660066">
    > <!-- MSCellType="NavBody" -->
    > <table border="1" cellpadding="0" cellspacing="0"
    > style="border-collapse: collapse" width="100%" id="table7">
    > <tr>
    > <td align="center">
    > <p align="center">
    > <b><font size="2"><a
    > href="javascript:history.back(1)">HOME</a></font></b></td>
    > </tr>
    > </table>
    > </td>
    > <td valign="top" height="419">
    > <!-- MSCellType="ContentBody" -->
    >
    > <%
    > 'here is the connection string
    > Set conn = server.createobject("adodb.connection")
    > 'this connection uses JET 4 it is the prefered method of connecting
    > to an access database
    > DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > Server.Mappath("/asplogin/login.mdb")
    > 'if you cant use JET then comment out the line above and uncomment
    > the line below
    > 'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
    > Server.Mappath("/asplogin/login.mdb")
    > conn.Open DSNtemp
    >
    > SQL = "Select * from "& tbl
    > pagetot = 10
    >
    > const adOpenForwardOnly = 0
    > const adOpenKeySet = 1
    > const adOpenDynamic = 2
    > const adOpenStatic = 3
    > const adLockReadOnly = 1
    > const adLockPessimistic = 2
    > const adLockOptimistic = 3
    > const adLockBatchOptimistic = 4
    > Set RS = Server.CreateObject("Adodb.RecordSet")
    > RS.Open SQL, Conn, adopenkeyset, adlockoptimistic
    > If RS.EOF Then
    > %>
    > <table cellspacing="1" border="0" cellpadding="2" width="100%">
    > <tr>
    > <td bgcolor="#CC0000">
    > <p align="center">
    > <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    > <font color="#FFFFFF">Sorry, no records were found. </font> <a
    > href="javascript:history.back(1)">Back To
    > <%=ttl%> Manager</a> </font></td>
    > </tr>
    > </table>
    > <font face="Verdana, Arial, Helvetica, sans-serif"><font size="2">
    > <%
    > ElseIf request("begin") = "" Then
    > begin = 1
    > Else
    > begin = Cint(request("begin"))
    > End If
    >
    > tot = ((begin+pagetot)-1)
    >
    > If tot > RS.RecordCount Then
    > tot = RS.RecordCount
    > End If
    >
    > i = 1
    > navi = ""
    > For j = 1 to RS.RecordCount step pagetot
    > If j <> 1 Then navi = navi & " | "
    > If j = Cint(begin) Then
    > navi = navi & "<b>"&i&"</b>"
    > Else
    > navi = navi & "<a href="""
    > navi = navi & Request.ServerVariables("url") & "?begin=" & j &
    > "&which=" & tbl
    > navi = navi & """>"
    > navi = navi & i & "</a>"
    > End If
    > i = i + 1
    > Next
    > i = 1
    > RS.Move begin - 1
    > %> </font>
    > <p align="center"><b><font size="4">Delete <%=ttl%></font></b></p>
    > </font>
    >
    >
    > <%
    > For x = begin to begin + (pagetot - 1)
    > If RS.EOF Then exit For
    > %>
    > <table border="1" cellpadding="0" cellspacing="0"
    > style="border-collapse: collapse" width="100%" id="table1"
    > bgcolor="#FFFFDD"> <tr>
    > <td><font face="Verdana" size="2">User Name:</font></td>
    > <td><font face="Verdana" size="2"><%=RS("uid")%></font></td>
    > <td><font face="Verdana" size="2">Address:</font></td>
    > <td><font face="Verdana" size="2"><%=RS("Address")%></font></td>
    > </tr>
    > <tr>
    > <td><font face="Verdana" size="2">Password:</font></td>
    > <td><font face="Verdana" size="2"><%=RS("pwd")%></font></td>
    > <td><font face="Verdana" size="2">ZIP Code:</font></td>
    > <td><font face="Verdana" size="2"><%=RS("ZIP")%></font></td>
    > </tr>
    > <tr>
    > <td><font face="Verdana" size="2">First Name:</font></td>
    > <td><font face="Verdana"
    > size="2"><%=RS("FirstName")%></font></td> <td><font
    > face="Verdana" size="2">City:</font></td> <td><font
    > face="Verdana" size="2"><%=RS("City")%></font></td> </tr>
    > <tr>
    > <td><font face="Verdana" size="2">Last Name:</font></td>
    > <td><font face="Verdana" size="2"><%=RS("LastName")%></font></td>
    > <td><font face="Verdana" size="2">Country:</font></td>
    > <td><font face="Verdana" size="2"><%=RS("Country")%></font></td>
    > </tr>
    > <tr>
    > <td><font face="Verdana" size="2">Phone:</font></td>
    > <td><font face="Verdana"
    > size="2"><%=RS("PhoneNumber")%></font></td> <td><font
    > face="Verdana" size="2">Mobile:</font></td> <td><font
    > face="Verdana" size="2"><%=RS("MobileNumber")%></font></td> </tr>
    > <tr>
    > <td><font face="Verdana" size="2">Fax:</font></td>
    > <td><font face="Verdana" size="2"><%=RS("Fax")%></font></td>
    > <td><font face="Verdana" size="2">Notes:</font></td>
    > <td><font face="Verdana" size="2"><%=RS("Notes")%></font></td>
    > </tr>
    > <tr>
    > <td colspan="4">
    > <p align="center">
    > <a href="delete2.asp?which=<%=tbl%>&id=<%=RS("id")%>" >
    > <img border="0" src="../images/btn_delete.gif" width="70"
    > height="30"></a></td>
    > </tr>
    > <tr>
    > <td colspan="4" bgcolor="#000000">&nbsp;</td>
    > </tr>
    > </table>
    > <%
    > i = i + 1
    > RS.MoveNext
    > Next
    > %>
    > <table cellspacing="2" cellpadding="2" width="100%">
    > <tr>
    > <td align="right">
    > <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    > <b><%=ttl%> <%=begin%>
    > - <%=tot%> of <%=RS.RecordCount%> Page:</b> <%=navi%> </font>
    > </td>
    > </tr>
    > </table>
    > <p>&nbsp;</p>
    > <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%
    > RS.Close
    > Set RS = nothing
    > Conn.close
    > Set Conn = Nothing
    > %> </font>
    > </td>
    > </tr>
    > <tr>
    > <td valign="top" height="50" width="544" bgcolor="#660066">
    > <!-- MSCellType="ContentFoot" -->
    > <p align="center"><font size="2" face="Verdana">
    > </td>
    > </tr>
    > </table>
    > </div>
    >
    > </body>
    >
    > </html>
    > ************************************************** '''
    > Thank you....
    >
    > /Goran
    >
    >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    > Version: 6.0.524 / Virus Database: 321 - Release Date: 06.10.2003


    Bob Barrows Guest

  5. #4

    Default Re: Please help with IF EOF TRUE

    Cigarette?

    "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote
    > Aaarghh! Why all the irrelevant html garbage????

    Ray at Guest

  6. #5

    Default Re: Please help with IF EOF TRUE

    :-)
    No, thanks

    Sorry Groan.

    Bob
    Ray at <%=sLocation%> wrote:
    > Cigarette?
    >
    > "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote
    >> Aaarghh! Why all the irrelevant html garbage????

    Bob Barrows Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139