加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

SqlDbType和Geography

发布时间:2020-12-12 06:28:09 所属栏目:MsSql教程 来源:网络整理
导读:当我的列是Geography类型时,我应该使用什么SqlDbType枚举?我正在使用MS SQL Server 2008 R2. 这是我正在寻找的具体内容: // ADO.net - what do I use for the SqlDbType when it's defined // as Geography in the stored procSqlCommand command = new Sql
当我的列是Geography类型时,我应该使用什么SqlDbType枚举?我正在使用MS SQL Server 2008 R2.

这是我正在寻找的具体内容:

// ADO.net - what do I use for the SqlDbType when it's defined 
// as Geography in the stored proc
SqlCommand command = new SqlCommand();
command.CommandText = "dbo.up_Foobar_Insert";
command.CommandType = CommandType.StoredProcedure;

command.Parameters.Add("@SomeGeographyType",SqlDbType.????);

解决方法

更新

试试这个:

//define parameter
command.Parameters.Add("@shape",SqlDbType.NVarChar);
//
//code in between omitted
//
//set value of parameter
command.Parameters["@shape"].Value = feature.Geometry.AsText();

取自Inserting SQL 2008 Geometry With a SqlCommand

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读