Is there any way by which we can find programmatically whether SQL Compact is installed or not... Actually I need to know whether the compact edition is installed or not in PC and so that I can include or exclude the SQL Compact dll... Because in my application there are different process that access the same .sdf file which will cause Access Violation error if those dll are included and compact is installed...
Any ideas?
I would assume a registry check is pretty reliable.
reg query "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5"
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5 InstallDir REG_SZ C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\ Version REG_SZ 3.5.5692.0 NativeDir REG_SZ C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\ ServicePackLevel REG_DWORD 0x1 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\ENU HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\GAC
You didn't mention the programming language you're using, but if you want to do this from .NET, use the Microsoft.Win32.Registry APIs.