Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 5th, 2006, 01:52 PM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems opening MS Access database

I'm using the following code in an ASP page (obviously there's more but this is the minimal testing code):

<%
'create ADO objects
Set cn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")

'Open connection.
strDBlocation = Request.ServerVariables("APPL_PHYSICAL_PATH") & "database\NDTdatabase.mdb"
strConn = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & strDBlocation & ";"
Response.write strConn
cn.Open strConn

'rs.Close
'cn.Close

The web server is on the same computer (Windows XP with IIS 5.0) that I'm using for development. Originally, I had the web application and database in an IIS virtual directory.

The error message I get from the cn.open strConn statement is:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

Commenting out the cn.Open statement, the Response.write displays:

Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:\inetpub\wwwroot\database\NDTdatabase.mdb;

I moved the application directly under wwwroot and moved the database to the same directory as the asp file to see if that would solve the problem. I commented out the strDBlocation, strConn, and previous cn.open statements and added the following:

cn.Open Driver={Microsoft Access Driver (*.mdb)}; DBQ=NDTdatabase.mdb;

I got the following error message:
Microsoft VBScript compilation (0x800A0408)
Invalid character
/Classes/test.asp, line 109, column 15
cn.Open Driver={Microsoft Access Driver (*.mdb)}; DBQ=NDTdatabase.mdb;
--------------^

I finally realized that the complaint was for the character after the =, so I put the Driver argument in quotes:

cn.Open Driver="{Microsoft Access Driver (*.mdb)}; DBQ=NDTdatabase.mdb;"

Now, I've got the error message:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/ndt/classes/test.asp, line 109

Eventually, I would like to have the database in a separate directory because it is accessed by several asp programs in several different directories.

I'm going nuts. Does anyone have any ideas?

Jay
Reply With Quote
  #2 (permalink)  
Old June 5th, 2006, 01:59 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. try this..

build an udl file and construct the connection string in there... to connect to an access database use jet oledb 4.0 (it will connect to any version of an access database)...

then copy the connection string to your app. that will sure solve your problem with the connection...

HTH

Gonzalo
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database migration MS Access 2003 to MS SQL 2000 ayazhoda SQL Server 2000 3 April 23rd, 2007 11:38 AM
Backing up an MS Access Database donrafeal7 Access VBA 2 October 11th, 2006 11:33 AM
writing to a ms access database angel79 Classic ASP Databases 2 May 25th, 2005 11:03 AM
Access issues with ASP and a MS Access Database rj_conceptsnrec.com Classic ASP Databases 2 May 19th, 2005 12:44 PM
Problems with Export to MS Access sammiebarnes SQL Server DTS 3 August 15th, 2003 08:54 AM



All times are GMT -4. The time now is 11:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.