Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection to MDB ???

Status
Not open for further replies.

ASPVB

Programmer
Jul 27, 2002
32
US
People ! Does somebody know the answer for my problem :
I write little site and using Microsoft Access DataBase.
I have 2 examples of connection string to my DB.

CONNECT_1 = "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" & Server.MapPath("/AD/spl/Script/AD.mdb")
CONNECT_2 = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("/AD/spl/Script/AD.mdb") & ";"

Both of them work when I take Recordsets(even complicated)!
===========================================================
But I try to Execute Insert or Update SQL-statment :

set cn=Server.CreateObject("adodb.connection")
cn.open CONNECT_1

cn.Execute "Insert Into Theme (Descr) Values ('" & nTmp & "')"

I get an error : Microsoft Jet Database Engine (0x800004005)
Operation must use an Updateable query .
-----------------------------------------------------------
set cn=Server.CreateObject("adodb.connection")
cn.open CONNECT_2

cn.Execute "Insert Into Theme (Descr) Values ('" & nTmp & "')"

I get an error : Microsoft OLE DB Provider for ODBC Drivers (0x800004005)
[Microsoft][ODBC Microsoft Access Drivers]
Operation must use an Updateable query .
 
I use this and it works. I guess you have to set it equal to a recordset. It will contain the error code on failure I believe (but that I'm not sure of...)
declarations:
dim conn
dim rs, rs2
Set Conn = Server.CreateObject("ADODB.Connection")
' conn.close
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Data\products.mdb")

update query:
ssql= "update domeinen set d_naamfr = '" & request("domfr") & "' where id_domein = "& request("domid")
set rs2 = conn.execute(ssql)
 
Sorry Smarty !
It's doesn't help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top