MS Access and Web Forms

  • Thread starter Thread starter Jason L James
  • Start date Start date
J

Jason L James

Hi all,

I am trying to browse a table in my MS Access DB
from a web form, using a bound datagrid. The DB
is populated, and the grid in on the web form. When
I execute the following code:

daDrawings.Fill(DsDrawings1.tblDrawing)
daIssue.Fill(DsDrawings1.tblIssue)

DataGrid1.DataSource = DsDrawings1.tblDrawing
DataGrid1.DataBind()

I get the following error:
The Microsoft Jet database engine cannot open the file 'C:\Documents
and Settings\jason\My Documents\Visual Studio
Projects\Cascades\myDB.mdb'. It is already opened exclusively by
another user, or you need permission to view its data.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: The Microsoft Jet
database engine cannot open the file 'C:\Documents and
Settings\jason\My Documents\Visual Studio
Projects\Cascades\myDB.mdb'.It is already opened exclusively by
another user, or you need permission to view its data.
Source Error:
Line 154: 'Put user code to initialize the page here
Line 155:
Line 156: daDrawings.Fill(DsDrawings1.tblDrawing)
Line 157: daIssue.Fill(DsDrawings1.tblIssue)
Line 158:

I am using a typed dataset. I have set the permission on the folder
that contains the MDB file and the access permissions to the file
itself for the Internet Guest Account on my machine and yet I still
get this error. The DB doesn't appear to be open.

Does anyone know what might be going wrong?

Many thanks,

Jason.
 
Hi Jason,

Are you using IIS? If so, have set up the application correctly in IIS? To
check this, go into IIS, view the properties on the web application, view
the Home Directory tab and see if the Application Protection is set to
Medium or High. If the Unload button to the right is enabled, click it. It
usually mean that IIS has kept the application open and it is this that
could be still using the Access file.

Another check that you could do is attempt to move it from that location to
see if it is really in use by anything.

Are you using the Application or Session objects to store open connections
.... yuck?! If so, you'll need to tidy the code up. When linking Access to
web forms, it is always good to use disconnected data, this way, the main
source remains free for anyone (authorised) to use.

Hope this helps.

Landers
 
Landers,

I think it was folder security that sorted it in the end. The
parent of the parent of the folder where the MDB file was
stored did not grant access to the guest account.

All seems fine now.

Thanks,

Jason.
 
Back
Top