【发布时间】:2014-09-15 14:11:40
【问题描述】:
我正在尝试使用 c# asp 将数据添加到 sql 中的地理字段。净。
添加 POINt 或 LINESTRING 时没有错误,但添加 POLYGON 时出现以下错误;
Message: [DataConnection.HandleError]: Query: Proc_CSA_AssetUpdateLocation: caused exception: A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":
System.ArgumentException: 24200: The specified input does not represent a valid geography instance.
System.ArgumentException:
at Microsoft.SqlServer.Types.SqlGeography.ConstructGeographyFromUserInput(GeoData g, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.Parse(SqlString s)
我传递的数据是(例如);
POLYGON((54.40854093377361 -6.197662353515625, 54.422126065167866 -6.212425231933594, 54.43011521616425 -6.164703369140625, 54.41093863702367 -6.128997802734375, 54.40094728183984 -6.150970458984375, 54.40854093377361 -6.197662353515625))
存储过程:
@Name nvarchar(20),
@ModifiedWhen DateTime,
@itemGUID UniqueIdentifier,
@GeoLocs nvarchar(max),
@Type int
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE dbo.csa_AssetGeoData
Set ItemModifiedWhen = @ModifiedWhen,GeoCord = @GeoLocs,GeographyTypeItemID = @Type, Name = @Name
WHERE ItemGUID = @itemGUID
不幸的是,无论我在哪里看,我都找不到数据错误的原因。
我的问题是什么可能导致此错误?
如有必要,我可以提供更多信息,抱歉,如果这太含糊(没有提供信息)。
【问题讨论】:
标签: c# sql asp.net .net geography