- C# project / Visual Studio 2015
- Build PC Windows 7 Pro 64 bit
- Client PC Windows 7 32 bit (x86)
- SQL Server Compact 4.0 / .net Framework 4.5
Code:
/// <summary>
/// Connects this instance.
/// </summary>
/// <returns></returns>
public bool Connect()
{
bool connected = true;
string cs = Properties.Settings.Default.ConnectionString;
try
{
cnn = new SqlCeConnection(cs);
cnn.Open();
connected = true;
}
catch(System.ArgumentException ae)
{
connected = false;
if(ae.HResult == -2146233067)
{
MessageBox.Show("Please check database location setting", "Arkema Database Connection Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
return connected;
}
catch(SqlCeException ex)
{
connected = false;
MessageBox.Show(ex.ToString(), "Arkema Database Connection Error", MessageBoxButton.OK, MessageBoxImage.Error);
return connected;
}
return connected;
}
Database file is NOT corrupt and NOT encrypted. Application works as designed on the build PC.
Receiving the following error when the application attempts to connect to the database on the Client PC:
System.Data.SqlServerCe.SqlCeException (x800004005): The database file may be corrupted. Run the repair utility to check the database file.
I used to CompactView to repair the database and received the following message:
System.Data.SqlServerCe.SqlCeException (x800004005): The database encryption mode is invalid..
I added the sqlce...40.dll
files to the app folder and that did not work either
Also tried turning off prefer 32bit, tried x86 instead of Any CPU
Help!!