Hi, I'm testing Telerik UI for WinForms.
I am trying to show points from a SQL Server database. But I can not make it work. This is the code
'Conection DataBase
go_con_sql.ConnectionString = "workstation id='.........';packet size=4096;user id=.......;pwd=.....;data source=..........;persist security info=False;initial catalog=EL_SAR_NET_V30_LUJAN"
go_con_sql.Open()
'Query **nod_obj is geometry data type
Dim ls_sql As String = " Select nod_id,nod_descripcion,nod_obj from mags.EL_Nodos "
lo_SqlCommand = go_con_sql.CreateCommand()
lo_SqlCommand.CommandText = ls_sql
le_ConnectionState = lo_SqlCommand.Connection.State
If lo_SqlCommand.Connection.State <> ConnectionState.Open Then lo_SqlCommand.Connection.Open()
lo_SqlDataAdapter = New SqlClient.SqlDataAdapter(lo_SqlCommand)
lo_SqlDataAdapter.Fill(lo_DataTable)
'Load Bing
Dim cacheFolder As String = "..\..\cache"
Dim bingProvider As BingRestMapProvider = New Telerik.WinControls.UI.BingRestMapProvider()
bingProvider.UseSession = True
bingProvider.BingKey = "JUnqKyILAJmo6DGiOQ1r~kPM5XDXLRRv1oTVw6XlLbQ~Ap55t-r-mO9JsRmL8z6YFqy6ivH1jv2CFsiEk4AP9JIJQnLfghVjCrIjCPVE-lDY"
Dim cache As New LocalFileCacheProvider(cacheFolder)
bingProvider.CacheProvider = cache
Me.RadMap1.Providers.Add(bingProvider)
'Load Layer Nodos
Dim layer As New MapLayer("Nodos")
Me.RadMap1.Layers.Add(layer)
Dim source As New BindingSource()
source.DataSource = lo_DataTable
Dim datareader As New SqlGeospatialDataReader()
datareader.Source = source
datareader.GeospatialPropertyName = "nod_obj"
'Here is error
Dim elements As List(Of MapVisualElement) = datareader.Read(source, "nod_obj", True, Nothing) ', True, Nothing
For Each item As MapVisualElement In elements
item.BorderColor = Color.YellowGreen
Next
Me.RadMap1.Layers("Nodos").AddRange(elements)
The error is "GeospatialPropertyName"
What am I doing wrong?
Thank you
Regards
Abel