2012-08-23 2 views
3

이것은 아마도 완전히 근본적이지는 않지만 - 어떤 이유로 SQL CLR 함수 (VB.NET)에서 SqlGeography 유형의 변수를 선언 할 수 없습니다. 다음은 SqlGeography가 3 행에 정의되어 있지 않다는 것을 보여줍니다. 뭔가를 가져와야하지만 확실히 찾을 수는 없습니다.SQL CLR 지형 유형

오 예 - 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

+0

예 - 유감스럽게도 대답이 너무 오래되었습니다 - 나는 목에 달려 왔습니다. :) – randmatt

답변

0

프로젝트의 Microsoft.SqlServer.Types에 대한 참조를 추가하십시오. 필자의 경우 C : \ Program Files (x86) \ Microsoft SQL Server \ 110 \ SDK \ Assemblies \ Microsoft.SqlServer.Types.dll에 있습니다.

그런 다음, 당신이 당신 된 .vb 파일의 상단에 다음과 같은 수입이 있는지 확인하십시오, 당신의 변수를 선언 할 수 있어야 그 후 수입 Microsoft.SqlServer 수입 Microsoft.SqlServer.Types

을 SqlGeography를 입력하십시오.