Question

What Type System Version (Compatibility Level) token can I specify in ADO.NET connection string to indicate that only SQL Server 2012 is supported?

Was it helpful?

Solution

According to this it will be "SQL Server 2012". While the page is for the .NET framework 4.5 and thus still pre release, given the other possible values for the parameter, it is safe to assume that this value will stand.

Having that said, I don't know if any .NET version below 4.5 will even accept that value as valid. I'm not at a computer right now, so I cannot check, sorry.

EDIT It looks as if this value is indeed parsed/checked on the client side, i.e. inside System.Data. Looking with Reflector, it happens in SqlConnectionString.SqlConnectionString(string connectionString). Also, there is an enumeration SqlConnectionString.TypeSystem which names all the known/supported values. For .NET 4.0 that would be SqlServer2000, SqlServer2005, SqlServer2008 and Latest. This value is the passed around inside the System.Data.SqlClient classes and ends up being used somewhere inside SqlDataReader.

So, unless you use Latest which would use but not force SQL Server 2012, there is no way to force SQL Server 2012 type system with .NET < 4.5.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top