fatbuddha
July 15th, 2002, 02:00 PM
In order to allow my C# Windows Application to use DAO 3.6, I include "Microsoft DAO 3.60" using the add references command, and add the following line to the source code:
using DAO;
I then put the following code, which establishes a connection to a database, into the main function:
DBEngine myDBEngine = new DBEngineClass();
Workspace myWorkspace = myDBEngine.CreateWorkspace("ODBCWorkspace", "Admin", "", WorkspaceTypeEnum.dbUseODBC);
Database myDatabase = myWorkspace.OpenDatabase("MyDNS", DriverPromptEnum.dbDriverNoPrompt, true, "ODBC;");
This all works fine, and I can make recordsets and retrieve records etc.
Now I use exactly the same technique and code in a Web Application project, but this time I get the exception thrown "ODBC--call failed" on the OpenDatabase() call. I've tried ODBC tracing and found a more detailed error:
DIAG [S1000] [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. (-1032)
The file is certainly not locked exclusively by another user, and so I must assume that there is permission problems. I've tried setting the IIS servers settings to minimum protection wherever possible - but still the same problem occurs. Weird eh?
Well I'm stumped on this one - so if any of the gurus could point me in the right direction, I'd be mighty grateful.
Rob Smith
using DAO;
I then put the following code, which establishes a connection to a database, into the main function:
DBEngine myDBEngine = new DBEngineClass();
Workspace myWorkspace = myDBEngine.CreateWorkspace("ODBCWorkspace", "Admin", "", WorkspaceTypeEnum.dbUseODBC);
Database myDatabase = myWorkspace.OpenDatabase("MyDNS", DriverPromptEnum.dbDriverNoPrompt, true, "ODBC;");
This all works fine, and I can make recordsets and retrieve records etc.
Now I use exactly the same technique and code in a Web Application project, but this time I get the exception thrown "ODBC--call failed" on the OpenDatabase() call. I've tried ODBC tracing and found a more detailed error:
DIAG [S1000] [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. (-1032)
The file is certainly not locked exclusively by another user, and so I must assume that there is permission problems. I've tried setting the IIS servers settings to minimum protection wherever possible - but still the same problem occurs. Weird eh?
Well I'm stumped on this one - so if any of the gurus could point me in the right direction, I'd be mighty grateful.
Rob Smith