ASP and ACCESS DB

Hi All

I am stuck with an aperently simple problem . I want to connect to an access DB with the following code:

dbfile=Server.MapPath("try.mdb")
Set con=Server.CreateObject("ADODB.Connection")
con.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile

sql="insert into products (product_name,product_price) " &_
"values ('skirt',0.00)"

set rs=server.createobject("adodb.recordset")
rs.open sql, con, 3, 3
con.close

but I keep on getting the following error message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/myweb/dbase/try.asp, line 14


But if I use a DSN ,with the following code ,there is no problem

Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "accessDSN"
con.execute sqlstring

But for launching purpose of my site I will have to use
the first method.

Can some one plese help me out of this boring problem

cheers

shakil









Comments

  • Hi

    I think the problem is a permissions problem. You will need to allow the anonymous user read and write access on your database file or on the folder in which it resides.

    See if that helps
    Cheers
    Jo

    : Hi All
    :
    : I am stuck with an aperently simple problem . I want to connect to an access DB with the following code:
    :
    : dbfile=Server.MapPath("try.mdb")
    : Set con=Server.CreateObject("ADODB.Connection")
    : con.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
    :
    : sql="insert into products (product_name,product_price) " &_
    : "values ('skirt',0.00)"
    :
    : set rs=server.createobject("adodb.recordset")
    : rs.open sql, con, 3, 3
    : con.close
    :
    : but I keep on getting the following error message:
    :
    : Error Type:
    : Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    : [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
    : /myweb/dbase/try.asp, line 14
    :
    :
    : But if I use a DSN ,with the following code ,there is no problem
    :
    : Set Con = Server.CreateObject( "ADODB.Connection" )
    : Con.Open "accessDSN"
    : con.execute sqlstring
    :
    : But for launching purpose of my site I will have to use
    : the first method.
    :
    : Can some one plese help me out of this boring problem
    :
    : cheers
    :
    : shakil
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :

  • : Hi All
    :
    : I am stuck with an aperently simple problem . I want to connect to an access DB with the following code:
    :
    : dbfile=Server.MapPath("try.mdb")
    : Set con=Server.CreateObject("ADODB.Connection")
    : con.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
    :
    : sql="insert into products (product_name,product_price) " &_
    : "values ('skirt',0.00)"
    :
    : set rs=server.createobject("adodb.recordset")
    : rs.open sql, con, 3, 3
    : con.close
    :
    : but I keep on getting the following error message:
    :
    : Error Type:
    : Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    : [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
    : /myweb/dbase/try.asp, line 14
    :
    :
    : But if I use a DSN ,with the following code ,there is no problem
    :
    : Set Con = Server.CreateObject( "ADODB.Connection" )
    : Con.Open "accessDSN"
    : con.execute sqlstring
    :
    : But for launching purpose of my site I will have to use
    : the first method.
    :
    : Can some one plese help me out of this boring problem


    When you work with a DSN, are you trying the exact same query? The most common cause of "operation must use an updateable query" is permission problems, but they only show up when you try to write to the database. If in your second example sqlstring = "SELECT * FROM MyTable", then it will work fine because it is just reading.

    But if sqlstring is also an INSERT or UPDATE query, then that probably isnt the problem.
  • Hi Joanne,

    thank you very much for the suggestion.
    My site workd perfectly now!!
    thanks again

    shakil



    : Hi
    :
    : I think the problem is a permissions problem. You will need to allow the anonymous user read and write access on your database file or on the folder in which it resides.
    :
    : See if that helps
    : Cheers
    : Jo
    :
    : : Hi All
    : :
    : : I am stuck with an aperently simple problem . I want to connect to an access DB with the following code:
    : :
    : : dbfile=Server.MapPath("try.mdb")
    : : Set con=Server.CreateObject("ADODB.Connection")
    : : con.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
    : :
    : : sql="insert into products (product_name,product_price) " &_
    : : "values ('skirt',0.00)"
    : :
    : : set rs=server.createobject("adodb.recordset")
    : : rs.open sql, con, 3, 3
    : : con.close
    : :
    : : but I keep on getting the following error message:
    : :
    : : Error Type:
    : : Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    : : [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
    : : /myweb/dbase/try.asp, line 14
    : :
    : :
    : : But if I use a DSN ,with the following code ,there is no problem
    : :
    : : Set Con = Server.CreateObject( "ADODB.Connection" )
    : : Con.Open "accessDSN"
    : : con.execute sqlstring
    : :
    : : But for launching purpose of my site I will have to use
    : : the first method.
    : :
    : : Can some one plese help me out of this boring problem
    : :
    : : cheers
    : :
    : : shakil
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    :
    :

  • Hi Manning,

    thank you very much for your suggestion.
    My site works perfectly now,I just changed the permission to 'read/write/append' !!

    shakil


    Hi All
    : :
    : : I am stuck with an aperently simple problem . I want to connect to an access DB with the following code:
    : :
    : : dbfile=Server.MapPath("try.mdb")
    : : Set con=Server.CreateObject("ADODB.Connection")
    : : con.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
    : :
    : : sql="insert into products (product_name,product_price) " &_
    : : "values ('skirt',0.00)"
    : :
    : : set rs=server.createobject("adodb.recordset")
    : : rs.open sql, con, 3, 3
    : : con.close
    : :
    : : but I keep on getting the following error message:
    : :
    : : Error Type:
    : : Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    : : [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
    : : /myweb/dbase/try.asp, line 14
    : :
    : :
    : : But if I use a DSN ,with the following code ,there is no problem
    : :
    : : Set Con = Server.CreateObject( "ADODB.Connection" )
    : : Con.Open "accessDSN"
    : : con.execute sqlstring
    : :
    : : But for launching purpose of my site I will have to use
    : : the first method.
    : :
    : : Can some one plese help me out of this boring problem
    :
    :
    : When you work with a DSN, are you trying the exact same query? The most common cause of "operation must use an updateable query" is permission problems, but they only show up when you try to write to the database. If in your second example sqlstring = "SELECT * FROM MyTable", then it will work fine because it is just reading.
    :
    : But if sqlstring is also an INSERT or UPDATE query, then that probably isnt the problem.
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories