Click here to Skip to main content
15,891,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Comments
[no name] 16-Dec-12 7:29am    
Please first rebuild your solution...
conanzz 16-Dec-12 7:32am    
I did, got the same error
[no name] 16-Dec-12 8:13am    
ok clean it and rebuild...
conanzz 16-Dec-12 8:17am    
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:23am    
here is my code: http://img856.imageshack.us/img856/9102/1216201242021pm.jpg

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.
 
Share this answer
 
Comments
conanzz 16-Dec-12 8:53am    
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:02am    
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.
Thanks, been solved by this path String:
HTML
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\DataBase.accdb"
 
Share this answer
 
VB
Source=|DataDirectory|\MyDB.mdb"


Solved it :)
 
Share this answer
 
Remove namespace [dbo]<tablename> (remove dbo) from the queries you are using. I removed it and it worked. The namespace redirects the connection to the shared folder of Microsoft
 
Share this answer
 
Comments
CHill60 11-Oct-14 12:03pm    
dbo with Access? As you can see from the solution posted 2 years ago it was a connection string problem.
follow the path given and copy your database file(like abc.accdb) their .it will work
 
Share this answer
 

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

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900