2

SQL Server CE 4.0 ( SqlServerCe.dll, v2.0.50727) に接続しようとすると、次のような例外 ( System.Data.Common.DbException) が発生します。

application/bin フォルダーにある CRT バイナリは署名されていないため、潜在的なセキュリティ リスクになる可能性があります。元の Microsoft CRT バイナリを application/bin フォルダーに配置してください。

すべてのファイルは microsoft.com からダウンロードされます

string localDataFile = Path.Combine(dataPath, "StorageData.sdf");
var connectionString = String.Format("Data Source={0}", localDataFile);

if (!File.Exists(localDataFile))
{
    SqlCeEngine engine = new SqlCeEngine(connectionString);
    engine.CreateDatabase();
    engine.Dispose();
}

var connection = new SqlCeConnection(connectionString); <----Here the exception occures
StorageContext context = new StorageContext(connection);

return context;

システム:

  • ウィンドウズ7
  • ビジュアル スタジオ 2010
  • .NET 4.0

何か案は?

更新: 次のファイルを再インストールすると、問題が修正されました。

助けてくれてありがとう!

4

1 に答える 1