Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows C#4.0 Access 64-bit , +
Hi,
 
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 Frown | :( 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 4:09am

1 solution

Rate this: bad
good
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 asp.net. If yes, why not try to include that file in your asp.net 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.
  Permalink  
Comments
Shemeer NS at 7-Jul-12 11:39am
   
that file is included in the App_Data folder of asp.net and correspondingly I have changed the path in web.config also.... then also it was giving same error...
seravan at 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
0 DamithSL 320
1 OriginalGriff 275
2 Sergey Alexandrovich Kryukov 187
3 Afzaal Ahmad Zeeshan 154
4 Peter Leow 115
0 OriginalGriff 7,510
1 DamithSL 5,494
2 Sergey Alexandrovich Kryukov 4,954
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 7 Jul 2012
Copyright © CodeProject, 1999-2014
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