GISCafe
   >> GIS Education
Thread views: 12366 View all threadsNext thread*Threaded Mode

guna82
(Stranger )
05/14/07 07:02 AM
urgent help with MatchRecordSet function Report this article as Inappropriate to us !!!Login to Reply

Hi All,
I am using Arcobjects and VB.NET 2005
I am trying to geocode a table into a record set. I am running into problems in one of the arguements for
MatchRecordSet(). The arguement i am getting error (or assuming so) is IpropertySet which contained the fields to the copied from the Input address table to the Geocoded result. I need to copy the StreetName regardless of whether its geocoded or not to the geocoded result.

The error i am getting is :
Exception from HRESULT: 0x80040653

The code works fine if i pass an empty propertyset.
Below is the code.

I am desperatly looking for help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
thanks in advance

Public Sub opentable(ByVal strarr() As String)
Dim wks As IFeatureWorkspace
Dim wksf As IWorkspaceFactory
Dim pAddressTable As ITable
Dim i As Integer
Dim pCursor As ICursor
Dim pcursor1 As ICursor

'pCursor = New Cursor
Dim paddressGeocoding As IAdvancedGeocoding2

Dim pRecordSetInit As IRecordSetInit
Dim pRecSet As IRecordSet

Dim pPropertySet As IPropertySet
pPropertySet = New PropertySet
Dim st1 As String


wksf = New AccessWorkspaceFactory

wks = wksf.OpenFromFile("C:\Prj\sfield\Police\PinMapping\Data\db1.mdb", 0)

For i = 0 To strarr.Length - 1

st1 = strarr(i)
If st1 Is Nothing Then
Exit Sub

End If
pAddressTable = wks.OpenTable(strarr(i))
pCursor = pAddressTable.Search(Nothing, True)
paddressGeocoding = getLocator("C:\Prj\sfield\Police\Dynamic Crime Mapping\output", "add_loc")
pRecordSetInit = New RecordSet

pRecordSetInit.CreateTable(paddressGeocoding.MatchFields)
'MsgBox(pCursor.Fields.Field(1).AliasName)
'**********************************************************************

Dim pAddressFields As ESRI.ArcGIS.Geodatabase.IFields
Dim pFieldsToCopy As IPropertySet

Dim pFieldsEdit As ESRI.ArcGIS.Geodatabase.IFieldsEdit
Dim pFieldEdit As ESRI.ArcGIS.Geodatabase.IFieldEdit
pFieldsEdit = New Fields

pFieldEdit = New Field
Dim pfield As IField
pfield = New Field


pAddressFields = pAddressTable.Fields
pFieldsToCopy = New PropertySet
'pfield = pAddressFields.Field(pAddressFields.FindField("Str_Name"))
pFieldEdit = pfield
pFieldEdit.Name_2 = "STREET"
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString

pFieldsEdit.AddField(pfield)
pFieldsToCopy.SetProperty("STREET", "Str_Name")
'pFieldsToCopy = pFieldsEdit

'****************************************************************

'paddressGeocoding.MatchRecordSet(pCursor, pCursor.Fields.Field(1).AliasName, pRecordSetInit, "Shape,Status,Score,Side,Match_Addr", pPropertySet, Nothing)


paddressGeocoding.MatchRecordSet(pCursor, pCursor.Fields.Field(1).AliasName, pRecordSetInit, "Shape,Status,Score,Side,Match_Addr", pFieldsToCopy, Nothing)
pRecSet = pRecordSetInit
'MsgBox(pRecSet.IsFeatureCollection)
end sub





Jump to

 

Trimble
Teledyne Optech
University of Denver GIS Masters Degree Online
CADalog.com - Countless CAD add-ons, plug-ins and more.



Internet Business Systems © 2016 Internet Business Systems, Inc.
595 Millich Dr., Suite 216, Campbell, CA 95008
+1 (408)-337-6870 — Contact Us, or visit our other sites:
AECCafe - Architectural Design and Engineering EDACafe - Electronic Design Automation TechJobsCafe - Technical Jobs and Resumes  MCADCafe - Mechanical Design and Engineering ShareCG - Share Computer Graphic (CG) Animation, 3D Art and 3D Models
  Privacy Policy