Can"t connect to an access database

Can"t connect to an access database

am 15.08.2005 14:49:37 von jj

Hi all

I am trying to connect to an access database with the following code:


Formular




<%
' Databaseforbindelse - husk at angive sti til din database
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("/db/database.mdb")

Conn.Open DSN

' SQL sætning opbygges

strSQL = "Insert into EmailAdresser (Email) values('" &
Request.Form("Email") & "')"

' SQL sætning eksekveres
Conn.Execute(strSQL)

' Luk databaseforbindelse
Conn.Close
Set Conn = Nothing
%>




but I get the following Error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open
registry key 'Temporary (volatile) Jet DSN for process 0x4c4 Thread 0x4d0
DBC 0x2e84024 Jet'.

Can anyone tell me what the problem is?

Thanks in advance

JJ

Re: Can"t connect to an access database

am 15.08.2005 15:26:12 von reb01501

jj wrote:
> Hi all
>
> I am trying to connect to an access database with the following code:
>


> Set Conn = Server.CreateObject("ADODB.Connection")
> DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
> DSN = DSN & "DBQ=" & Server.MapPath("/db/database.mdb")
>
> Conn.Open DSN
>


> but I get the following Error:
>
> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC Microsoft Access Driver]General error Unable to open
> registry key 'Temporary (volatile) Jet DSN for process 0x4c4 Thread
> 0x4d0 DBC 0x2e84024 Jet'.
>
> Can anyone tell me what the problem is?
>

Yes: the problem is you are using the obsolete ODBC provider instead of the
newer OLE DB provider. Try:
Conn.Open "Provider=microsoft.jet.oledb.4.0;" & _
"data source=" & Server.MapPath("/db/database.mdb")

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: Can"t connect to an access database

am 15.08.2005 16:54:08 von jj

Yes it helped - Thank you very much
"Bob Barrows [MVP]" skrev i en meddelelse
news:%23QvHpzZoFHA.576@TK2MSFTNGP15.phx.gbl...
> jj wrote:
>> Hi all
>>
>> I am trying to connect to an access database with the following code:
>>
>
>
>> Set Conn = Server.CreateObject("ADODB.Connection")
>> DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
>> DSN = DSN & "DBQ=" & Server.MapPath("/db/database.mdb")
>>
>> Conn.Open DSN
>>
>
>
>> but I get the following Error:
>>
>> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
>> [Microsoft][ODBC Microsoft Access Driver]General error Unable to open
>> registry key 'Temporary (volatile) Jet DSN for process 0x4c4 Thread
>> 0x4d0 DBC 0x2e84024 Jet'.
>>
>> Can anyone tell me what the problem is?
>>
>
> Yes: the problem is you are using the obsolete ODBC provider instead of
> the
> newer OLE DB provider. Try:
> Conn.Open "Provider=microsoft.jet.oledb.4.0;" & _
> "data source=" & Server.MapPath("/db/database.mdb")
>
> Bob Barrows
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>