...

View Full Version : Database connection error



fogofogo
09-13-2005, 08:05 PM
Hi All,

I'm having a bit of a problem inserting some info into a database. Heres my code:

<%
dim strFirst
dim strEmail

strFirst = Request.Form("name")
strEmail = Request.Form("email")

Response.Write(strFirst) & "<br>"
Response.Write(strEmail)


MyPath=Server.MapPath("emails_names.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & MyPath

SQL = "INSERT INTO details (Name, Email) VALUES ('"&strFirst&"','"&strEmail&"')"
conn.Execute(SQL)
%>


and heres the error message:

"Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/flash_capture/project3/processForm.asp, line 21"


Line 21 is conn.Execute(SQL). I'm fairly new to asp so I apologise if the error is blindingly obvious.

Thanks

Bullschmidt
09-14-2005, 04:14 AM
I just tested with a small Access database with a table named details and your code worked just fine. Maybe you're using a query (SQL string) with joins and the query isn't updateable or something.

But here is a related link:

Why do I get database-related 80004005 errors?
http://www.aspfaq.com/show.asp?id=2009
<<
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access 97 Driver] Operation must use an updateable query.
This is almost always a permissions issue, where IUSR_machineName or the autheticated user doesn't have read or write access to the MDB file, the folder in which it is located, or the TEMP/TMP folders.
>>

So I'd see about adding some permissions to the folder the database resides in.

And for a connection string that's supposed to be a little more robust:

http://www.carlprothman.net/Default.aspx?tabid=87#OLEDBProviderForMicrosoftJet



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum