SQL Server Compact Code Snippet of the Week #12 : get the SQL Server Compact runtime version
Your app/web site may require a specific build version of the SQL Server Compact runtime, due to dependency on a bug fix, for example. This weeks code snippet will demonstrate how to get that information. I have an older blog post here, that goes into deep details about the various ways to get SQL Server Compact related version information.
To get the SQL Server Compact build version for 3.5 SP2 and 4.0, you can simply use:
var ver = new System.Data.SqlServerCe.SqlCeConnection().ServerVersion;
For SQL Server Compact 4.0 SP1, this returns: 4.0.8876.1.
And for SQL Server Compact 3.5 SP2 CU6, the value would be: 3.5.8088.0
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)