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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP: Connecting to an Access DB

Status
Not open for further replies.

flanakin

Programmer
Mar 21, 2000
158
US
For some reason I am not able to connect to my database. Here's the code:

Set DBConnect = Server.CreateObject("ADODB.Connection")
DBConnect.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=c4"

The database (c4.mdb) is in the same directory as the file using the code. And, the error is:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x604 Thread 0x6cc DBC 0x2133fc4 Jet'.

Any help is appreciated. Thanks. [sig]<p>Cid<br><a href=mailto:ciddivine@yahoo.com>ciddivine@yahoo.com</a><br><a href= > </a><br> [/sig]
 
you may get better help if you post this in the ASP (Active Server Page) Fourm, as for your problem, try telling it the direct path to the mdb, or create a DSN (unless you really want a DNSless connection) [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
How would I create a DSN-less connection???

I get the following error with the DSN:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.

This doesn't make any sense cause it's not open by anything. [sig]<p>Cid<br><a href=mailto:ciddivine@yahoo.com>ciddivine@yahoo.com</a><br><a href= > </a><br> [/sig]
 
you're already creating a DNS-less connection, by specifying the path and type of DB, to create a DSN , on the server (or wherever you are running the ASP off of) goto control pannel , then ODBC32 , then goto System DSN, and click add, follow the steps (for Access, its easy, click on Microsoft Access Database (*.mdb), then type in the DSN name youw ant to use then click Select to point to where the database is) then in your source you use.

[tt]
DBConnect.Open &quot;DSN=yourdsnname&quot;
[/tt]

since everything is predefined in ODBC32 now, you can just refer to the DSN name, also its helpful when you have to move your source around, you can change the path in ODBC32, rather than change the source code all the time. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
I have a DSN for it. That gives me the error I stated above.

[sig]<p>Cid<br><a href=mailto:ciddivine@yahoo.com>ciddivine@yahoo.com</a><br><a href= > </a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top