Monday, 12 May 2014

Connection String for .sdf database in App_Data in WPF Application.

Connection String for .sdf database in App_Data in WPF Application.



first create a App_Data folder in your project then add .sdf database in it, after that include your app.config file if not present in your project by right clicking on project then new item then app.config. So in your app.config file write this line.

<configuration>
  <connectionStrings>
    <add name="my" 
connectionString =" Data Source =|DataDirectory|\App_Data\your_database_name.sdf; Persist Security Info=True"
            providerName="Microsoft.SqlServerCe.Client.4.0"/>
  </connectionStrings>
</configuration>

so, simple.
Enjoy.

No comments:

Post a Comment