Error when connecting to Microsoft Access db

V

VB Programmer

I get an error when I connect to my mdb. I know for sure that I dont have
it open and that the path is correct.

Here's the error:

System.Data.OleDb.OleDbException: The Microsoft Jet database engine cannot
open the file 'C:\Inetpub\wwwroot\MyTest\MyDatabase.mdb'. It is already
opened exclusively by another user, or you need permission to view its data.
at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) at
System.Data.OleDb.OleDbConnection.InitializeProvider() at
System.Data.OleDb.OleDbConnection.Open() at
LatLongTest.EmailNotification.GetEmailRecipients() in
c:\inetpub\wwwroot\LatLongTest\EmailNotification.aspx.vb:line
118System.InvalidOperationException: ExecuteReader requires an open and
available Connection. The connection's current state is Closed. at
System.Data.OleDb.OleDbConnection.SetStateExecuting(OleDbCommand attempt,
String method, Boolean flag) at
System.Data.OleDb.OleDbCommand.ValidateConnectionAndTransaction(String
method, Int32& localState) at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) at
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at
LatLongTest.EmailNotification.GetEmailRecipients() in
c:\inetpub\wwwroot\LatLongTest\EmailNotification.aspx.vb:line 132
 
Joined
Oct 1, 2006
Messages
1
Reaction score
0
ASP.NET Exception

Hi Everyone,

I have got through this problem with opening the access database in ASP.NET.
The error message looks like this:

The database is already open exclusively by another user ...


The actual cause for this problem is not with Permissions or any other security setting in IIS.

The code should be correct and there are three steps you need to follow.

1. Fill the dataset using the adaptor
2. Set the datasource of the datagrid or any data control
3. Call the databind of the respective control

for ex.

OleDbDataAdapter1.Fill(Dsemp1, "newemp")
DataGrid1.DataSource = Dsemp1
DataGrid1.DataBind()

Here the table name is "newemp" and dataset is "dsemp1"

Check with the spelling of these two objects for this could be the root cause of the problem.

Happy Coding!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,160
Latest member
CollinStri
Top