system.data.oledb.oledbexception (0x80004005): could not find file - c#

Can someone help me with this error please? I can't figure it out. I have this error on Windows XP but not on Windows 7. What I did is i attached a photo and save it to the database (MS Access as my database). The photo appears on the picture box but then after that all is a mess. Im using C#.

Your data file is an accdb file, thus requiring the ACE provider instead of the JET provider. Use the JET provider to read mdb or xls files. The ACE provider, on the hand, can read mdb, accdb, xls, xlsx, plus other formats.
Also, it is best to specify complete path to you file in the Data Source property of your connection string.

Do check that the path point to a mdb in the App_Data folder
Not very sure but if the database is inside the App_Data folder, simply use:
"PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|StaffingSystem_DB.mdb"

Goto Project properties->Publish->Application File, in the applications file window change Publish Status of something.accdb from Include(Auto) to Data File

Related

How to access a database file with non mdf extension

Can we access a database file with non-.MDF extension using C#?
We are creating a setup project. We don't want the user to know the database details which is installed in the installation folder. So, I have tried renaming the database data file and log file with a random name without any extension.
When I have tried accessing the file from c# we are getting an error like:
An attempt to attach an auto-named database to file D:\SQLExpress\DB\abc123tmp failed. A database of the same name exists, or specified file cannot be opened, or it is located at UNC share.
Can anyone help me solve the issue?
Start SSMS, connect to (localDb)\MSSQLLOCALDB and look at the Databases attached ... I guess the File you want to attach is already attached under a different name. Detach that instance first and then your Connection should work. It's not possible to attach the same File using different Database names. The File Extension does not matter.

C# building/resource/publish/create and exe file with database

I was wondering how can I create the exe file for the app I made. I tried giving the exe file in the bind/debug folder together with the database (MS Access). But having an error with the filename of the mdb file, it is pointing to my directory.
{
InitializeComponent();
connection.ConnectionString = #"Provider=Microsoft.Jet.OLEDB.4.0;
Data Data Source=C:\Users\asdf\Documents\questionbank.mdb;
Persist Security Info=True;
Jet OLEDB:Database Password=asdfasdf";
}
And the error getting is "Windows cannot access the specified device, path, or file. You may not have the appropriate permission to access the item.
Put your connection string in a configuration file, eg., by createing a setting in the Settings tab when you right click on your project and go to Properties.
Hard coding your connection details, as you've done, means it cannot change when you deploy your application.

Host database (SQL Server) errors

I am trying to host my website and the database, but I have same problems and I don't know why .
This is the error message:
Or try this:
Open Notepad, type
icacls "c:\dzsqls" /grant Everyone:(f)
Then save it as SQLPermission.bat file and double click the newly saved file. This will give full control to Everyone to the C:\dzsqls folder. When done, test your connection again. If you have trouble, report back

Error to to navigate the database location

i made a small program to insert ,update and delete data from access database and it's work fine on computer , but when i copy it to another computer i had problem to to navigate the database location. this is the path in the source code.
string DBPath = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Almarkaz.accdb;Jet OLEDB:Database Password=123456;";
Even if i copy the database to the same directory that i have in the source still have problem.
Any ideas please. THANKS ALOT
by the file extension .accdb is the access file, Please make sure you have Microsoft Office Access installed in both the machine and check the file path "E:\Almarkaz.accdb" in both the machine with full access.
good luck.

Trouble to open XLS file with oledb

When I try to open an xls file, I get this error :
Rhe Microsoft Office Access database engine cannot open or write to the file ''.
It is already opened exclusively by another user, or you need permission to view and write its data.
I do several access but I close and dispose the connection all the time. It's on my DEV PC. On the server I get this error : Don't have read/write access on the file. This file is on \networkdisk\directory1\Files
I'll use "ACE.OLEDB" because Jet is not running on x64 server.
Any idea ?
Thanks,
In my case it was a file stream that had not been closed.
in our case, a client uploaded an excel file that is password protected

Categories