bugraotken

Selecting and showing a value from Oracle Table

Discussion created by bugraotken on Dec 31, 2013
Latest reply on Jan 2, 2014 by vangelo-esristaff
Hi all !

- I have a feature layer (CADASTRAL_PARSEL) and a Oracle Table (ABS_PARCEL).
- OBJECTID field of feature layer and SDE_OBJECT_ID of Oracle Table are same.
- I have a form that searchs for block/parsel from feature layer, shows its 3 value for "neighborhood - section - area"
- The other part of the form shows the same values from Oracle Table. Our municipality fills this table with another program (management program) The fields mentioned above are same.

I am posting a part of the code that starts with cursor that has values of selected block/parcel. The problem is i can not enter QueryFilter for this SDE_OBJECT_ID field of Oracle Table = pfeature.value(intobjectid) of selected feature.

SDE_OBJECT_ID field of Oracle table is Long.

By the way i found this link and its similar with my problem but it doesn't help me that much:

http://forums.esri.com/Thread.asp?c=93&f=992&t=86418

Dim pFeatureClass As IFeatureClass
Set pFeatureClass = pFeatureLayer.FeatureClass

Dim pFields As IFields
Set pFields = pFeatureClass.Fields

Dim intSdeNeighbourhood As Integer
intSdeNeighbourhood = pFields.FindField("NAME_NEIGHBOURHOOD")

Dim intSdeCadastralSection As Integer
intSdeCadastralSection = pFields.FindField("CADASTRAL_SECTION")

Dim intSdeArea As Integer
intSdeArea = pFields.FindField("AREA")

Dim intObject As Integer
intObject = pFields.FindField("OBJECTID")

Dim pTable As ITable
Set pTable = pFeatureClass

Dim pCursor As ICursor
Set pCursor = pTable.Search(pQueryFilter, False) 'YOU DONT SEE THE UPPER CODES BUT ITS OK, EVERYTHING IS WORKING

Dim pRow As IRow
Set pRow = pCursor.NextRow

Dim pFeature As IFeature
Set pFeature = pRow

sde_neighbourhood.Caption = pFeature.Value(intSdeNeighbourhood)
sde_section.Caption = pFeature.Value(intSdeCadastralSection)
sde_area.Caption = pFeature.Value(intSdeArea)

'----------------------------------------------------------------------------------
'Here i open Oracle Table

Dim pPropset As IPropertySet
Set pPropset = New PropertySet

pPropset.SetProperty "DATABASE", "C:\Users\botken1\Desktop\ArcObject_Denemeler.mdb"
pPropset.SetProperty "DATAPROVIDER", "Access Data Source"

Dim pWorkspaceFactory As IWorkspaceFactory
Set pWorkspaceFactory = New AccessWorkspaceFactory

Dim pFeatureWorkspace As IFeatureWorkspace
Set pFeatureWorkspace = pWorkspaceFactory.Open(pPropset, 0)

'Open the Table
Dim pUTable As ITable
Set pUTable = pFeatureWorkspace.OpenTable("ABS_PARCEL")

Dim pUFields As IFields
Set pUFields = pUTable.Fields

Dim intSdeObjectID As Integer
intSdeObjectID = pUFields.FindField("SDE_OBJECT_ID")

Dim pURow As IRow
Set pURow = pUTable

'here i try to show the Oracle Table values with the objectid of selected feature

Dim pQueryFilterUKBS As IQueryFilter
Set pQueryFilterUKBS = New QueryFilter

Dim strSdeOID As String
strSdeOID = pFeature.Value(intObject)

'pQueryFilterUKBS.WhereClause = "SDE_OBJECT_ID = 123" THIS CODE WORKS, IT BRINGS YOU THE VALUE OF NEIHGBOURHOOD, SECTION AND AREA OF THE VALUE 123 FROM ORACLE TABLE BUT I DONT WANT TO SEE THE VALUE OF 123, I WANT THE OBJECTID OF SELECTED FEATURE FROM SDE LAYER

pQueryFilterUKBS.WhereClause = "SDE_NESNE_NO = pfeature.value(intobject)" THIS CODE DOESNT WORK AT ALL. IF I CAN MAKE IT WORK THEN EVERYTHING WILL BE OK

Dim pUCursor As ICursor
Set pUCursor = pUTable.Search(pQueryFilterUKBS, False)

Dim pURow As IRow
Set pURow = pUCursor.NextRow

Dim intUSection As Integer
intUSection = pUFields.FindField("ORACLE_SECTION")

ukbs_section.caption = pURow.Value(intSection)

End Sub

Can you please help me?
Thanks in advance.

Outcomes