Sql server win10不支持类型为“地理”的字段
这是一个在windows 10中使用dotnetframework4.6.1执行的程序Sql server win10不支持类型为“地理”的字段,sql-server,windows-10,geography,Sql Server,Windows 10,Geography,这是一个在windows 10中使用dotnetframework4.6.1执行的程序 public void GetData() { string sConnectionString; sConnectionString = @"Data Source=www.somedomain.com;Initial Catalog=iislog;Persist Security Info=True;User ID=iislog;Password=password";
public void GetData()
{
string sConnectionString;
sConnectionString = @"Data Source=www.somedomain.com;Initial Catalog=iislog;Persist Security Info=True;User ID=iislog;Password=password";
SqlConnection Conn = new SqlConnection(sConnectionString);
Conn.Open();
SqlDataAdapter adapter;
DataSet ds;
ds = new DataSet();
adapter = new SqlDataAdapter("Select top 10 name From geo", Conn);
adapter.Fill(ds, "name");
adapter = new SqlDataAdapter("Select top 10 geo From geo", Conn);
adapter.Fill(ds, "geo");
}
数据库引擎是ms sqlsever 2008,
geo是一个包含字段的表
他的类型是地理,还有另一个领域
其类型为nvarchar(50)
当执行到station时
适配器。填充(ds,“geo”);
引发了一个异常
但如果我在Windows7中执行该程序,则不会发生错误
异常屏幕截图:
表格结构:
确保在Windows 10框中安装了
Microsoft.SqlServer.Types
程序集。对SqlGeography
的支持不随.net提供。为了不太容易,您没有包括有关异常的详细信息?添加了异常屏幕截图。谢谢