Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Nov 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    adodb.connection can not execute (1)

    Dear all:

    I set up a asp page to update access 2000 database. the following is some code
    StrConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " &server.mapPath("./") & "/db1.mdb;"
    set objConn = Server.createObject("ADODB.Connection")
    objConn.open strConnect
    objConn.execute "INSERT into contacts ([firstname],[lastname]) values('test', 'test')"
    ...

    However, it can not run. giving the following errors:

    Error Type:
    Microsoft JET Database Engine (0x80004005)
    Unknown function name

    if I change insert query to update query, it works fine

    Thank you for your help

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: adodb.connection can not execute (1)

    All of your connection info looks fine, although I would recommend changing your connection string's data source to read: Data Source=" & Server.MapPath("../db1.mdb") & ";"

    The Unknown function implies that there's a custom function in a query. It looks unrelated to the code you posted.

    However, just for fun, check your SQL Statement - perhaps try:
    INSERT INTO contacts (firstname, lastname) VALUES(""test"",""test"")"

    (remove square brackets and add double-quotes instead of single quotes)

    I don't think these suggestions will make much of a difference, but give them a shot anyway...

    I usually use a Recordset Object for adding data (when SQL Server isn't available), so you might also try that if you don't get anywhere with this SQL statement.
    Just create and open a Recordset object to the current table (Cursor Type = adOpenDynamic or adOpenKeyset, Lock Type = adLockOptimistic), then Recordset.AddNew....

    Post back if it doesn't work...

Posting Permissions

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