Error when connected to Access MDB

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
 
M

Miha Markic [MVP C#]

Hi,

Give aspnet local windows account (asuming you are running w2k or wxp) ntfs
privileges on mdb file.
 
V

VB Programmer

Thanks!
Miha Markic said:
Hi,

Give aspnet local windows account (asuming you are running w2k or wxp) ntfs
privileges on mdb file.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

VB Programmer said:
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
 
W

William Ryan eMVP

Miha: we really need to nail down a faq ;-) This gives a lot of people a
lot of trouble, and it's one of those issues you can't go any further with
until you fix.


Miha Markic said:
Hi,

Give aspnet local windows account (asuming you are running w2k or wxp) ntfs
privileges on mdb file.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

VB Programmer said:
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
 
S

sterling

If you use Microsofts ODBC.NET Data Provider instead of OleDB.NET, it will
let you have more than one connection to the database, it creates a
connection pool. When using OleDb to open a database it locks the database,
and it has a time out of so many seconds before it releases the connection
something like 10 secs after its closed. When your using the ExecuteReader
no matter what the provider is, you can't use the same OleDbConnection to
execute another instance of ExecuteReader with the same OleDbConnection. If
you open Component Services and find the connection that has been created
for your application you will see that when your application runs it will
create a service for the application when it executes. You can manually
release the connection, so you don't have to wait for OleDB to release it
while your testing your code.
Hope this helps.
Sterling
 
M

Miha Markic [MVP C#]

William Ryan eMVP said:
Miha: we really need to nail down a faq ;-) This gives a lot of people a
lot of trouble, and it's one of those issues you can't go any further with
until you fix.

It would be nice that it would appear to user before he/she posts :)
 
W

William Ryan eMVP

I posted your reply to the same question asked at 5:46. The CF guys posted a
FAQ on the MSDN site for commonly asked CF questions. I don't think there's
an ADO.NET version but I could be wrong. If not, it sure would be a good
idea since a good many questions here are asked pretty regularly.
 

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

Top