Click here to Skip to main content
12,554,041 members (68,669 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Windows C#4.0 Access 64-bit , +

I'm trying to connect MS Access (*.mdb file) from ASP.NET, Everything Works fine in windows application in my PC. the same code giving error in ASP.NET

In ASP.NET Oledb connection is success but while reading from datatreader its giving a strange error :(, Any idea on this issue? Pls help, Thanks In advance

the code is as follows

Connection string is

<add name="oledbCon" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\mydatabase.mdb" providerName="System.Data.OleDb"/>

Everything works fine in windows application the same code in ASP.NET throws error from the below line
reader = cmd.ExecuteReader();

Error is

Could not find file 'C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\dbo.mdb'

where as in my connection string I can see the my datasource as D:\mydatabase.mdb from debug window

Steps I tried is given below

changed the from AnyCPU to x86 in VS 2010 configuration

Pls not : MS Access is 32 bit and Windows 7 64 bit, and VS 2010 configuration changed to x86, When I'm getting this error I checked the connection state in quickwatch and its in Open state.
Posted 7-Jul-12 3:09am
Shemeer NS122.5K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Not sure if i got your problem correctly but what i've understand is that you are encounterring the error when in If yes, why not try to include that file in your project just like the images or misc files and from there youll just map it.

Its working on windows app because youre just in your computer not a host.
Shemeer NS 7-Jul-12 11:39am
that file is included in the App_Data folder of and correspondingly I have changed the path in web.config also.... then also it was giving same error...
seravan 9-Jul-12 0:47am
Based from the connection string it's pointing to D drive while on you error it's pointing on the C drive and also a different MS Access file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 7 Jul 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100