Forum Moderators: open

Message Too Old, No Replies

ASPX and Access

Database connection

         

Ugly

11:34 am on Jul 21, 2005 (gmt 0)

10+ Year Member



I am a new ASPX user. Just got back from a training course where we only used SQL server. I need to read an Access 2000 database, but cant't get my connection right. I am using an OLEDB connection and dataadapter, but when i try to populate a dataset and view it in IE, i get the following error

*************
Exception Details: System.Data.OleDb.OleDbException: The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\BasildonMapping\data\basildon.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
**************

any advice or help would be greatly appreciated.

mrMister

11:48 am on Jul 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you got the database open in the Access application by any chance?

If not then try deleting the basildon.ldb file.

Ugly

11:53 am on Jul 21, 2005 (gmt 0)

10+ Year Member



Hi
Thanks for the reply.
This database is not in use by anyone or any system. There is no .ldb file.

wingnut

1:03 pm on Jul 21, 2005 (gmt 0)

10+ Year Member



Permissions on the directory containing the DB?

Not sure which app you are using to create the page code but if it is like Dreamweaver (Excel does this as well) it can lock the db file until closed. Though, again like Mister said, you usually see a .lb file.

Ugly

1:18 pm on Jul 21, 2005 (gmt 0)

10+ Year Member



Thanks again.

I am using Visual Studio .NET. I have given full permissions (for testing) to the directory of the DB for both my user and the IUSR (for testing in a web browser). There is NO .ldb.

mrMister

2:02 pm on Jul 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am using Visual Studio .NET

Well no wonder you've got problems ;-)

Have ypou given full permissions to the ASPNET account? I'd also give permissions to IWAM and IIS, just to be sure!

Are you using VS.Net to access the database at all?

GaryK

2:21 pm on Jul 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I ran into the exact same problem a few days ago. A quick search of the MSKB revealed an article (#253604) which stated that Access may need to create temporary files in places you might not expect like the Windows folder and the Windows Temp folder.

The above mentioned article stated it applied to Access 97 and also to ASP 4.0 but following the instructions about the temp folder(s) solved the problem for me and I'm using Access 2003 with an Access 2000 database.

It might not be the same in .NET but then again it might be. Hope this helps.

Ugly

3:07 pm on Jul 21, 2005 (gmt 0)

10+ Year Member



Cheers for all your help.

Unfortunatly, none of that worked, but i have solved it, found some code on another forum, for your info it is below

Dim dspostcode As New DataSet()
Dim objAdapterpostcode As OleDb.OleDbDataAdapter
objCon = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database")
objAdapterpostcode = New OleDb.OleDbDataAdapter (" appropriate SQL", objCon)
objAdapterpostcode.Fill(dspostcode)
cmbPostcode.DataSource = dspostcode.Tables(0).DefaultView
cmbPostcode.DataTextField = "Postcode"
cmbPostcode.DataBind()

Thanks again.

mfewtrell

8:57 am on Jul 26, 2005 (gmt 0)

10+ Year Member



The problem is with the permissions on the folder that holds the database (this is an old but quite well known issue). As mentioned in one of the earlier posts you need to give full access to the ASPNET account (or create this account if it doesn’t already exist) and then provide at least read access to all users.

I can’t remember the correct settings for a production server but if this is a development server the security won’t be to important so give ASPNET full access and everybody Read, Write, Execute.