#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0

    Either BOF or EOF is True, or the current record has been deleted


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

    This is the error I recieve when trying to run my site. I know why. I am passing a non existed URL Parameter. However I would like to recieve a MsgBox that says that such record doesn't exist. Beloe I will paste the source code. Please help. Thank You.

    ------------------------ Source Code Starts-------------------------------
    <%
    Dim rsProfile__MMColParam

    rsProfile__MMColParam = "1"

    If (Request.QueryString("MemID") <> "") Then
    rsProfile__MMColParam = Request.QueryString("MemID")
    End If

    %>
    <%
    Dim rsProfile
    Dim rsProfile_numRows

    Set rsProfile = Server.CreateObject("ADODB.Recordset")
    rsProfile.ActiveConnection = MM_conn_ued_STRING
    rsProfile.Source = "SELECT * FROM ClanMem WHERE MemID = '" + Replace(rsProfile__MMColParam, "'", "''") + "'"
    rsProfile.CursorType = 0
    rsProfile.CursorLocation = 2
    rsProfile.LockType = 1
    rsProfile.Open()

    rsProfile_numRows = 0
    %>

    ------------------------ Source Code Ends-------------------------------
  2. #2
  3. No Profile Picture
    Standards User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    146
    Rep Power
    12
    Don't know if this is the best approach, but maybe it will help....

    <%
    ' If there is no ID in the URL string
    If (Request.QueryString("MemID") = "") Then
    ' There is nothing selected, display message
    %>
    <script language="VBScript">
    dim Message
    Message=MsgBox("Such record doesn't exist",65,"Error")
    document.write(Message)
    </script>
    <%
    End If
    %>

    I do something similar, except I just write out an error message, as VBScript won't run in Netscape. I guess it just depends on what you're trying to do, but you could even do a simple JavaScript alert.


    <script language="JavaScript">
    <!--//
    alert('Such record doesn\'t exist')
    //-->
    </script>
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0

    Something else.


    Thanks a lot for your help. However you mis-understood what I need. I need that if such a record ("MemID") doesn't exist than display message.
  6. #4
  7. No Profile Picture
    Standards User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    146
    Rep Power
    12

    Whoops


    My bad, wasn't fully absorbing eveything.
    You just need to change the if statement to handle the error you're getting
    Code:
    <% If rsProfile.EOF And rsProfile.BOF Then %>
    <script language="VBScript">
    dim Message
    Message=MsgBox("Such record doesn't exist",65,"Error")
    document.write(Message)
    </script>
    <% End If %>
    That way if a non-existent parameter is passed they'll receive the Msgbox.
    It appears that you're using Dreamweaver. If you're using MX you can do this by selecting the msgbox code, then on the application panel click the server behavior tab and go to "Show Region" and select "Show Region If recordset is empty"

IMN logo majestic logo threadwatch logo seochat tools logo