Results 1 to 11 of 11
  1. #1
    Join Date
    Feb 2004
    Posts
    41

    Question Unanswered: Access Database permission problem

    I am using the following code snippet to delete a record from an Access database:

    <%
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open(Server.Mappath("personal.mdb"))

    sql="DELETE * FROM plant_list"
    sql=sql & " WHERE plant_id=" & request.QueryString("entry")
    response.Write(sql)
    response.write("<br />")
    on error resume next
    conn.Execute sql
    if err<>0 then
    response.write err.description
    else
    response.write("Record " & request.QueryString("entry") & " was deleted!")
    end if
    conn.close
    %>

    I did NOT set any password on the database through Access.

    I get the following error:

    "Could not delete from specified tables."

    I did a response.write (sql) to make sure the query was properly formatted. It returned:

    "DELETE * FROM plant_list WHERE plant_id=18"

    The database exists, the table exists, the field exists, as does record id 18.

    The database has all permissions on the server.

    What am I doing wrong?

    Any help is appreciated! Thanks.

  2. #2
    Join Date
    Jul 2003
    Location
    Penang, Malaysia
    Posts
    212
    Try setting "write" permission to the folder from ISS server where your MDB file is.

    Is it already set to "write" permission?
    Patrick Chua
    LBMS ( Learn By My Self) NPQ ( No paper Qualification )

  3. #3
    Join Date
    Feb 2004
    Posts
    41
    Yes, I double checked. It was already set 777 or read, write, execute.

    I also tried moving the database into different directories. Each time it produced the same error:

    "Could not delete from specified tables."

    Is it something I need to set in the access database itself?

    Any ideas?

    Thanks.

  4. #4
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    And the field IS a number field instead of a text field right (since no single quotes)?
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  5. #5
    Join Date
    Feb 2004
    Posts
    41
    Yes, it is an "AutoNumber" field.

    Thanks for your response.

    Any other ideas?

    This is driving me nuts! (slowly)

  6. #6
    Join Date
    Feb 2004
    Posts
    41
    Anyone with an idea? Thanks.

  7. #7
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    You don't have any foriegn key constraints on that table do you??

    Have you tried runnign the query from within access to see if it gives you more details about the error??
    Last edited by rokslide; 02-18-04 at 21:06.

  8. #8
    Join Date
    Feb 2004
    Posts
    41
    Sombody told me that maybe I shouldn't have the * in the query. I have tried it both ways, and still get the error.

    Yes, I ran the query from within Access on my local machine and it deletes the record without problem.

  9. #9
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    What is your local machine and how does it differ from your server??

  10. #10
    Join Date
    Feb 2004
    Posts
    41
    local machine = home where I am doing the programming
    server = web server where my website resides

    Hope that clarifies it.

  11. #11
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    OS's?? Web Server Software? etc

Posting Permissions

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