Hi
how can I get data from table/Field = EXTRA.House / number
Public Sub search_address()
Dim pMap As IMap
Dim pMxDoc As IMxDocument
Dim pFeatLayer As IFeatureLayer
Dim pFeatSel As IFeatureSelection
Dim pQueryFilter As IQueryFilter
pMxDoc = CType(My.ArcMap.Application.Document, IMxDocument)
pMap = pMxDoc.FocusMap
Dim sLayerName As String
sLayerName = Layer_address
Dim i As Integer
For i = 0 To pMap.LayerCount - 1
If pMap.Layer(i).Name = sLayerName Then
pFeatLayer = pMap.Layer(i)
Exit For
End If
Next i
If pFeatLayer Is Nothing Then
MsgBox(Layer_address & " Error")
Exit Sub
End If
pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = "HEI1 in (select HEI1 from EXTRA.House where number = 2502163)"
Dim pFeaCursor As IFeatureCursor = pFeatLayer.Search(pQueryFilter, False)
Dim pFeature As IFeature = pFeaCursor.NextFeature
Do Until pFeature Is Nothing
Dim index As Integer = pFeature.Fields.FindField("STREETNAMECODE") 'O(n)
Dim sName As String = pFeature.Value(index)
Dim newItem As New ListViewItem(pFeature.OID)
If IsDBNull(pFeature.Value(pFeature.Fields.FindField("POSTALCODE"))) = False Then
newItem.SubItems.Add(pFeature.Value(pFeature.Fields.FindField("POSTALCODE")))
Else
newItem.SubItems.Add("")
End If
If IsDBNull(pFeature.Value(pFeature.Fields.FindField("STREETNAME"))) = False Then
newItem.SubItems.Add(pFeature.Value(pFeature.Fields.FindField("STREETNAME")))
Else
newItem.SubItems.Add("")
End If
Listv_search.Items.Add(newItem)
pFeature = pFeaCursor.NextFeature
Loop
Hi,
Here is your problem:
pQueryFilter.WhereClause = "HEI1 in (select HEI1 from EXTRA.House where number = 2502163)"
You need to add to WhereClause only where section of your query:
pQueryFilter.WhereClause = "number = 2502163"
I can get record from pFeatLayer but I can not get record from EXTRA.House
pQueryFilter.WhereClause = "HEI1 in (select HEI1 from EXTRA.House where number = 2502163)"
What is your backend data source, RDBMS, FGDB, etc...? I assume you are getting an error, what exactly is the error message?