Click here to Skip to main content
Sign Up to vote bad
good
I`ve connected an web page with access database, when I try to add a new record, I get this error:
(Could not find file 'C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\DataBase.accdb'.)
 
note: my data base is already in App_Data folder.
 
and when I copy db file into that path, any inserting will be in that path not in the one in App_Data!!
 
how to fix it to keep changes only in the original database ?
Posted 16 Dec '12 - 1:24
conanzz389

Comments
Krunal Rohit - 16 Dec '12 - 7:29
Please first rebuild your solution...
conanzz - 16 Dec '12 - 7:32
I did, got the same error
Krunal Rohit - 16 Dec '12 - 8:13
ok clean it and rebuild...
conanzz - 16 Dec '12 - 8:17
no use, can u tell me, should I keep a copy in that path: devserver\10.0\.. ? or just stick with that data base in App_data ?
conanzz - 16 Dec '12 - 8:23
here is my code: http://img856.imageshack.us/img856/9102/1216201242021pm.jpg

3 solutions

Thanks, been solved by this path String:
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\DataBase.accdb"
  Permalink  
The message is quite clear, you are trying to use a path to a file that does not exist. Your error is most likely because you are using a relative path for your database in your connection string (.\DataBase.accdb). Change your path to the correct location of your database and try again.
  Permalink  
Comments
conanzz - 16 Dec '12 - 8:53
well, you`re right, It`ll work when I keep the full path which is C:\Users\Administrator\Documents\Visual Studio 2010\Projects\WebApplication5\WebApplication5\App_Data\DataBase.accdb put I want to keep it portable for my teacher, I`ll send it to him. dunno what to call this situation :(
Richard MacCutchan - 16 Dec '12 - 10:02
If you want to make it portable then you need to add some extra code to locate the file at the start of the application; see this link for more information.
Source=|DataDirectory|\MyDB.mdb"
 
Solved it Smile | :)
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 8,356
1 OriginalGriff 6,571
2 CPallini 3,533
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 22 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid