首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >条件中SqlGeography类型之间的STIntersects,如果

条件中SqlGeography类型之间的STIntersects,如果
EN

Stack Overflow用户
提问于 2015-10-29 21:01:07
回答 2查看 116关注 0票数 1

我使用SqlGeography类型。

STIntersects函数的以下用法是否有所不同:

代码语言:javascript
复制
this.Location.STIntersects(another.Location)

代码语言:javascript
复制
this.Location.STIntersects(another.Location).Value

代码语言:javascript
复制
this.Location.STIntersects(another.Location).Equals(1)

我得到了不同的结果。

EN

回答 2

Stack Overflow用户

发布于 2015-10-29 21:27:02

问题是SqlIntersects方法返回的不是布尔值,它返回的是SqlBoolean结构

假设您的地理位置相交,我将假设您获得以下值:

this.Location.STIntersects(another.Location) => true

this.Location.STIntersects(another.Location).Value =>返回SqlBoolean返回值的值比例=> true

this.Location.STIntersects(another.Location).Equals(1) =>将SqlBoolean结构与值1进行比较,并返回false

票数 1
EN

Stack Overflow用户

发布于 2015-10-29 22:24:17

马修·埃文斯给出了完整的答案。这是相同的答案,但措辞不同。

如果两个位置相交,则

  • Location.STIntersects(another.Location)返回一个包含trueSqlBoolean,否则它返回一个false.
  • Location.STIntersects(another.Location).Value,返回truefalse类型为System.Boolean而不是SqlBoolean above.
  • Location.STIntersects(another.Location).Equals(1)返回"。因此,它将始终以您正在比较的方式返回false。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33415004

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档