Professional Web Applications Themes

deleting access database record - ASP Database

I am trying to write an asp page to delete a record from my access database. I have written the page to display the info but when I select the entry to be deleted I get the following error message: ADODB.Recordset (0x800A0BCD) Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. /delete_entry.asp, line 20 Here is the code I am using: <% option Explicit Dim adoCon Dim rsDeleteEntry Dim strSQL Dim IngRecordNo IngRecordNo = CLng(Request.QueryString("ID_no")) Set adoCon = Server.CreateObject("ADODB.Connection") adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("ccalls.mdb") Set rsDeleteEntry = Server.CreateObject("ADODB.Recordset") ...

  1. #1

    Default deleting access database record

    I am trying to write an asp page to delete a record from my access database. I have written the page to display the info but when I select the entry to be deleted I get the following error message:
    ADODB.Recordset (0x800A0BCD)
    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
    /delete_entry.asp, line 20

    Here is the code I am using:
    <%
    option Explicit
    Dim adoCon
    Dim rsDeleteEntry
    Dim strSQL
    Dim IngRecordNo

    IngRecordNo = CLng(Request.QueryString("ID_no"))

    Set adoCon = Server.CreateObject("ADODB.Connection")

    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("ccalls.mdb")

    Set rsDeleteEntry = Server.CreateObject("ADODB.Recordset")

    strSQL = "SELECT calltable.* FROM calltable WHERE ID_no=" & IngRecordNo

    rsDeleteEntry.LockType = 3
    rsDeleteEntry.Open strSQL, adoCon
    rsDeleteEntry.Delete
    rsDeleteEntry.Close

    Set DeleteEntry = Nothing
    Set adoCon = Nothing
    Response.Redirect "delete_select.asp"
    %>

    I think it has to do with the EOF but I am new to asp and a little lost. :)
    Thanks Tim

    -----------------------------
    This message is posted by [url]http://Asp.ForumsZone.com[/url]

    Tim Midgett Guest

  2. #2

    Default Re: deleting access database record


    Yea still at it Ray :)
    I will give it a try. I hope I understand enought to do what you
    suggested. hehe (tough to teach a newbie)
    Thanks Tim


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Tim Midgett Guest

  3. #3

    Default Re: deleting access database record

    Hey Ray thanks got it to work with the following:


    <%
    option Explicit
    Dim adoCon
    Dim rsDeleteEntry
    Dim strSQL
    Dim IngRecordNo

    IngRecordNo = CLng(Request.QueryString("ID"))

    Set adoCon = Server.CreateObject("ADODB.Connection")

    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
    Server.MapPath("ccalls.mdb")

    adoCon.EXECUTE "DELETE FROM calltable WHERE ID_no=" & ingRecordNo

    Set adoCon = Nothing
    Response.Redirect "delete_select.asp"
    %>

    Thanks Tim

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Tim Midgett Guest

  4. #4

    Default Re: deleting access database record

    Outstanding! Excellent job! Good feeling when something works for the
    first time, isn't it? One suggestion. Add

    adoCon.Close

    before you set it to nothing.

    Ray at work

    "Tim Midgett" <tmidgettunitedfidelity.com> wrote in message
    news:%23XPG2IkRDHA.3768tk2msftngp13.phx.gbl...
    > Hey Ray thanks got it to work with the following:
    >
    >
    > <%
    > option Explicit
    > Dim adoCon
    > Dim rsDeleteEntry
    > Dim strSQL
    > Dim IngRecordNo
    >
    > IngRecordNo = CLng(Request.QueryString("ID"))
    >
    > Set adoCon = Server.CreateObject("ADODB.Connection")
    >
    > adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
    > Server.MapPath("ccalls.mdb")
    >
    > adoCon.EXECUTE "DELETE FROM calltable WHERE ID_no=" & ingRecordNo
    >
    > Set adoCon = Nothing
    > Response.Redirect "delete_select.asp"
    > %>
    >
    > Thanks Tim
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ray at Guest

Similar Threads

  1. deleting DNS record using dnscmd.exe
    By Kumar in forum ASP.NET Web Services
    Replies: 0
    Last Post: October 14th, 11:05 AM
  2. Deleting a Record.
    By Rob in forum PHP Development
    Replies: 7
    Last Post: November 24th, 07:05 AM
  3. problems adding record to access database
    By Sérgio Almeida in forum ASP Database
    Replies: 6
    Last Post: October 24th, 05:44 PM
  4. Trouble with database access: can't edit record, just view it
    By Gerhard in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: August 27th, 05:30 AM
  5. editing record in access database
    By Tim Midgett in forum ASP Database
    Replies: 4
    Last Post: July 10th, 04:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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