PRB: "Couldn't find file 'Unknown'" Error when Language=JScript

ID: Q189206


The information in this article applies to:


SYMPTOMS

When the default language is set to JScript for Active Server Pages (ASP) pages connecting to a file-based database (for example, Access, Visual FoxPro) returns an error such as the following:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access 97 Driver] Couldn't find file '(unknown)'.
This error occurs only with connect strings that contain discrete or UNC paths such as "c:\newdata\backup.mdb" or \\servername\sharename\backup.mdb, respectively. For example, adding a data connection to a Visual InterDev 1.0 Web Project for the adventure works database from within Visual InterDev 1.0 would create the following connection string in your Global.asa:

   "DSN=AdvWorks;DBQ=C:\InetPub\ASPSAMP\AdvWorks\AdvWorks.mdb;
   DriverId=25;FIL=MS Access;MaxBufferSize=512;PageTimeout=5;"); 
When trying to open a text file, an error occurs such as the following:
Server object error 'ASP 0177 : 800a0034'
Server.CreateObject Failed
This error occurs when calling GetFile or OpenTextFile as in the following:

   fl = fs.OpenTextFile("c:\\myfile.txt", 1, 0,0); 


CAUSE

The error is due to the backslash character (\) being used as a delimiter both in file paths and as the identifier for "escape sequences" in JScript.

Examples of escape sequences are "\n" for a new line or "\b" for a backspace. Two backslashes (\\) resolve to a single backslash. If the character following the backslash is not a known escape sequence identifier, the backslash is ignored.

As a result, JScript resolves the string "c:\newdata\backup.mdb" to "c: ewdataackup.mdb" where the "\n" is replaced with a carriage return and the "\b" is replaced with a backspace. JScript would resolve "\\servername\sharename\backup.mdb" to "\servernamesharenameackup.mdb" where the "\\" is replaced with a single backslash and "\b" is replaced with a backspace.

In cases such as these, the resulting string passed to the Connection.Open method is an invalid file location, resulting in an error.


RESOLUTION

There are several possible workarounds:


STATUS

This behavior is by design.

Additional query words: kbADO kbASP kbVisID


Keywords          : kbASPObj kbODBC kbVisID100 kbVisID600 kbGrpASP 
Version           : WINDOWS:1.0,1.5,6.0
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: May 13, 1999