SQL CLR 地理类型

4

也许我完全错了 - 但是由于某种原因,我无法在SQL CLR函数(VB.NET)中声明SqlGeography类型的变量。以下内容说明第3行未定义SqlGeography - 我很确定需要导入一些内容 - 但找不到它。

哦,是的 - 使用SSDT。

任何帮助都会感激。

Public Shared Sub usp_routing_dijkstra(node_1 As SqlGuid, node_2 As SqlGuid)

    Dim StartGeo As SqlGeography

    Using connection As New SqlConnection("context connection=true")
        connection.Open()

        Using command As New SqlCommand("select [geo] from [nodes] where [sys_id] = @id", connection)
            Dim param As New SqlParameter("@id", SqlDbType.UniqueIdentifier)
            param.Value = node_1
            command.Parameters.Add(param)
            Dim StartNode As Object
            StartNode = command.ExecuteScalar()
            If StartNode IsNot Nothing Then

            End If
        End Using

    End Using

End Sub

1
你有 Microsoft.SqlServer.Types 的参考吗? - mfussenegger
抱歉让你久等了,我一直忙得不可开交 :) - randmatt
1个回答

1

尝试在您的项目中添加对Microsoft.SqlServer.Types的引用。在我的情况下,它位于C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.Types.dll。

然后,请确保您在.vb文件顶部具有以下Imports:

Imports Microsoft.SqlServer Imports Microsoft.SqlServer.Types

之后,您应该能够声明一个SqlGeography类型的变量。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接