During creating Polygon it throws execution. I am using library Microsoft.SqlServer.Types latest version 160.
polyText = "POLYGON ((
45.3972179 8.8406638000000157,
45.4215054 8.9151509000000715,
45.4001544 8.9361126999999669,
45.4016369 8.9607184999999845,
45.3851877 8.9621395000000348,
45.3853039 8.948319999999967,
45.3747296 8.9535720999999739,
45.3858019 8.9360727000000679,
45.3579525 8.8890794000000142,
45.3414371 8.90664240000001,
45.3452409 8.91328980000003,
45.3273192 8.92622259999996,
45.3185438 8.9208002999999962,
45.3405949 8.8954118000000335,
45.3471543 8.866777299999967,
45.3587372 8.8690788999999768,
45.3675493 8.8504374999999982,
45.3972179 8.8406638000000157,
45.3972179 8.8406638000000157,
45.3972179 8.8406638000000157
))
"
SqlGeography poly = SqlGeography.STGeomFromText(new SqlChars(polyText), 4326);
Exception statk
SQL Server Spatial library could not be loaded. Error code: 126 (HResult: 0x80131524).
Microsoft.SqlServer.Types
System.IO.FileNotFoundException: SQL Server Spatial library could not be loaded. Error code: 126 (HResult: 0x80131524).
at Microsoft.SqlServer.Types.GLNativeMethods.ThowIfGLNativeLibraryNotLoaded()
at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticIsValid(GeoData& g, Double eccentricity, Boolean forceKatmai)
at Microsoft.SqlServer.Types.SqlGeography.IsValidExpensive(Boolean forceKatmai)
at Microsoft.SqlServer.Types.SqlGeography..ctor(GeoData g, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.STGeomFromText(SqlChars geometryTaggedText, Int32 srid)
at webNet.Area.Default.DrawShapesFromSql(String polyText, String areaName) in C:\Project\webNet\Area\Default.aspx.cs:line 474
at webNet.Area.Default.LoadForm() in C:\Project\webNet\Area\Default.aspx.cs:line 93
Created SqlGeography.Point
it works fine without problem, only creating reading inserting polygon due it throws error.