Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I want to use ms access database to my asp.net but some error happened when use password protected ms access database. Work file when i use non-password protected ms access database. Error is "Cannot open database. it may not be database that your application recognized, or the file may be corrupt."

What I have tried:

C#
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:/Database.accdb;Jet OLEDB:Database Password=12345678");
                if (con.State == ConnectionState.Closed) { con.Open(); }<pre>
Posted
Updated 29-Dec-16 23:07pm
Comments
Maciej Los 30-Dec-16 5:03am    
Are you sure that your application has an access into D drive?
I'd suggest to read this: Access connection strings - ConnectionStrings.com[^], espacially: DataDirectory functionality
Abhilask kumar 31-Dec-16 2:53am    
yes access database exist in D drive. and i tried from connectionstrings.com. Same thing connect well without password protected database file. Any way to add password in database file from asp.net?

1 solution

First of all, please read my comment to the question.

I'd suggest to start here: Walkthrough: Creating a Web Page to Display Access Database Data[^]

But... I have to warn you:
Microsoft Access database is not recommended for web applications!!!


For further details, please see: ASP.NET Data Access Options[^]
 
Share this answer
 
v2
Comments
Abhilask kumar 30-Dec-16 5:36am    
I connect ms access database successfully without database password but when i put password in database then problem has occur.

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



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