Click here to Skip to main content
15,889,876 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have an application (winform with vs2012) using sql localdb v11 database i need how to add a password to the database ?
this is my connection string :

C#
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
     
        <add name="Gestion_De_Vente.Properties.Settings.Gestion_De_VenteConnectionString1"
            connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Gestion_De_Vente.mdf;Integrated Security=True;Connect Timeout=30;Encrypt=False"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>
Posted

1 solution

Your connection string is specifying Integrated Security = true so a password doesn't mean anything to your connection. It's using the security token you got when you logged into Windows.
 
Share this answer
 
Comments
Mohammed-cd7 1-Jul-15 9:12am    
but when i deploy my application with the database in other machine, I need to use a password to the database because the database file (.mdf) is installed with the the files of the application.
Dave Kreskowiak 1-Jul-15 12:02pm    
First, don't reply to a post by adding another "solution".

Second, that's not the reason you need to add a password.

Are you trying to add a password to the database so nobody else can use it?


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