Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
Hi,
I'm using an MS Access database which has password (database password, not a workgroup or smth).
I'm using 13 characters - with no special signs- only letters.
When I try to open the DB from access it works fine, but when I try to run my Windows Form application from Visual Studio Connection String, I get a message that "Not a valid password".

In the app.config, I'm using this for connection string:

[CODE]<connectionstrings>
<add name="esystem.my.settings.esystemdbconnectionstring" connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\esystem.mdb;Jet OLEDB:Database Password=abcd;" providername="system.data.oledb"/>
</connectionstrings>
[/CODE]

by the way, if I unset the password in my ACCESS DB, the connection string works perfect.
anywone have any idea what might be the problem?

Thanks.
Posted

I Think You Need To Specify The
C#
<connectionstrings>
<add name="esystem.my.settings.esystemdbconnectionstring" connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\esystem.mdb;Jet OLEDB:<b><u>User ID:Administrator;</u></b>Database Password=abcd;" providername="system.data.oledb" />
</connectionstrings>

Please Check That.

Because While Connecting To MS Access DB Through VS We Need The User Name And Password.

So Check The User Name For Your MS Access DB

Also There Is Another Method. Create A udl File And Set The Connection From There. You Will Get The Connection String.

Accept The Answer If It Has Helped You
 
Share this answer
 
v2
Comments
danait25 8-Feb-12 3:18am    
HiI tried that (in several ways)already and it didn't work..
:(
Please verify whether abcd is replaced with actual password, because similar statement is working well with my password protected Access Database.
 
Share this answer
 
Comments
danait25 8-Feb-12 3:56am    
what do you mean by "replaced with actual password"- how can I verify that?
ProEnggSoft 8-Feb-12 4:01am    
I mean to put actual password of the datbase in place of abcd in the connection string, as the statement worked with my password protected database.
danait25 8-Feb-12 4:19am    
I have an actual password in my DB and I added the same password to the connection string. if I insert the password directly in ACCESS, it works. it just doesn't work through the connectionstring ..
ProEnggSoft 8-Feb-12 4:58am    
Have you tried through database connection wizard in Visual Studio i.e.
Data->Add New Database->Database->New Connection
Then in the Add Connection dialog, there is a button
TestConnection
After selecting the required database using the browse button in this dialog, if you click TestConnection, it displays the message Test connection succeeded if the connection is proper and generates the appropriate connection string. You can keep the user name as Admin, which is filled up by default when the dialog is opened.
I hope this may solve your problem.
ProEnggSoft 14-Feb-12 0:56am    
Thank you for accepting the answer :-)

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