Skip to content Skip to sidebar Skip to footer

Sql Ce 3.5 & Entityframework

I have an sqlce 3.5 local db file in my VS2010 solution used with an EF4 Model. I need to protect my db with a password but do not serialize it in app.config. I also need to set up

Solution 1:

Do not use the SqlConnectionStringBuilder, it is designed for SQL Server connections, not for SQL Server Compact. Simply set

string providerString = @"Data Source=|DataDirectory|\Database\dbFileName.sdf;Password=abc;Max Database Size=4091"; 

Solution 2:

I am getting the same error when I use DbContext constructor and have tried using different connection strings. A similar connection string works fine if I use SqlCeConnection. This works fine

SQL_CONNECTION_STRING = String.Format("password={0};Persist Security Info=True;Data Source={1};Max Database Size=1024", scsb.Password, ccdaSetup.DataSource);

Post a Comment for "Sql Ce 3.5 & Entityframework"