martes, abril 15, 2008

GET SQL Compact Version

En este post dejo un codigo que encontre para sacar la version del SQL Compact:

internal enum SSCEVersion
{
Unknown,
v3_1,
v3_5
}

internal static SSCEVersion GetDatabaseVersion(string path)
{
uint signature = 0;

using (FileStream stream = new FileStream(path, FileMode.Open))
{
using (BinaryReader reader = new BinaryReader(stream))
{
stream.Seek(16, SeekOrigin.Begin);

signature = reader.ReadUInt32();
}
}

switch (signature)
{
case 0x00357b9d: // 3.5
return SSCEVersion.v3_5;
case 0x002dd714: // 3.1
return SSCEVersion.v3_1;
default:
return SSCEVersion.Unknown;
}
}


Fuente: http://blog.opennetcf.org/ctacke/PermaLink,guid,d839eeb7-2cb6-4842-a504-93d1bab0b0af.aspx

No hay comentarios.: