deleting access database record

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

  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. Similar Questions and Discussions

    1. deleting DNS record using dnscmd.exe
      Hello, I want to delete a record "comwebcam.yahoo" from the zone "com" When typing - dnscmd localhost /recorddelete com comwebcam.yahoo A I...
    2. Deleting a Record.
      Thanks for the Help on the other problems...all resolved. One last (hopefullly) problem I can't seem to get around for this program...why isn't...
    3. problems adding record to access database
      Greetings I'm having problems adding records to an access database. What I want to do is very simple. Here is my code. __CODE_START__ dim...
    4. Trouble with database access: can't edit record, just view it
      Hallo! I use DWMX 6.1 and use ASP VBSCRIPT files to access a MS Access 2000 database. Initially I was able to edit the records. Then I had to add...
    5. editing record in access database
      I am trying to pull a record into a form and then edit it. (not working to well) Hoping someone can show me a better way than this: <% option...
  3. #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

  4. #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

  5. #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" <tmidgett@unitedfidelity.com> wrote in message
    news:%23XPG2IkRDHA.3768@tk2msftngp13.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

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