SqlDbType 和地理 [英] SqlDbType and Geography
本文介绍了SqlDbType 和地理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我的列是地理类型时,我应该使用什么 SqlDbType 枚举?我正在使用 MS SQL Server 2008 R2.
What SqlDbType enumeration should I use when my column is the Geography type? I'm using MS SQL Server 2008 R2.
这是我正在寻找的具体内容:
This is what I'm looking for specifically:
// 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();
取自 插入 SQL2008 带有 SqlCommand 的几何
这篇关于SqlDbType 和地理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文