I'm researching how to load a .shp file into Geography columns in SQL 2008.
I'm reading this blog: http://consultingblogs.emc.com/stevewright/archive/2009/01/23/how-to-load-spatial-data-into-sql-server-2008-from-net.aspx and it states:
To use the SqlGeography C# type you need to add reference to the following name space: Microsoft.SqlServer.Types. This can be found in the following dll: Microsoft.SqlServer.Types.dll
However, I don't see that anywhere on my machine. I was looking in the Add Reference under the .Net tab and the COM tab and I don't see it. I searched for Microsoft.SqlServer.Types.dll
on my machine as well and did not find it.
Is there something I need to install on my machine to be able to use SqlGeography in C#?
UPDATE!
After finishing reading the blog entry I found this:
Like the report viewer control the Microsoft.SqlServer.Types namespace is not installed with .Net. For the application to work on another computer, without having to install SQL server or their client tools, a Redistributable package would need to be installed.
The SQL Server System CLR Types package contains the components implementing the new geometry, geography, and hierarchyid types in SQL Server 2008. This component can be installed separately from the server to allow client applications to use these types outside of the server. A version can be found here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en
However, the link is no longer valid.... So does anyone know where I can get this .dll?
UPDATE w/Answer!
I wound up doing a search online and found that the dll exists here:
C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Types.dll
Once I added that reference I no longer saw the error and I'm able to use the SqlGeography as a type in C#.
These exist as a nuget package now
https://www.nuget.org/packages/Microsoft.SqlServer.Types/
so it is better to use that rather than a direct ref to the DLL.
I wound up doing a search online and found that the dll exists here:
C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Types.dll
Once I added that reference I no longer saw the error and I'm able to use the SqlGeography as a type in C#.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With