CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2000
    Location
    Kansas
    Posts
    49

    Internet Database Problem

    I'm having trouble deleting a row from an access database on an internet server using asp. I can select everything from it just fine but when I go to delete a row this error message comes across:

    Microsoft JET Database Engine error '80004005'

    Could not delete from specified tables.

    Here's the code I'm using to delete a row:


    set MyConn = Server.CreateObject("ADODB.Connection")

    cnpath= server.mappath("Users.mdb") & ";User Id=admin;Password=;"

    Myconn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= "& cnpath

    SQL_query = "Delete FROM Company WHERE CompanyID= "& ID

    set lRecordSet = MyConn.Execute(SQL_query)



    There are no relationships set up either. Any help would be greatly appreciated.




  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Internet Database Problem

    All SQL statements must end with ; , your doesn't, add the character at the end of statement.

    Your code should look like this

    set MyConn = Server.CreateObject("ADODB.Connection")
    cnpath= server.mappath("Users.mdb") & ";User Id=admin;Password=;"
    Myconn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= "& cnpath
    SQL_query = "Delete FROM Company WHERE CompanyID= "& ID & ";" ' <-- added ; here
    set lRecordSet = MyConn.Execute(SQL_query)




    I hope it works

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Feb 2000
    Location
    Kansas
    Posts
    49

    Re: Internet Database Problem

    Putting the ; at the end didn't work. I still get the exact same error as before. Any other ideas? Thanks for your last input.


  4. #4
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Internet Database Problem

    Can you add or modify records? The database might be read-only, or it just doesn't allow users to delete records.

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured