Приветствую своих коллег!
Сам занимаюсь программированием на АркГИСе недавно, так что возникла такая проблема, выходит ошибка "run-time error '-2147467259 (80004005)'" при работе программы и не могу понять почему, если не трудно - подскажите что делать, код представлен ниже, и строка на которой возникает ошибка помечена.
Public Sub MergeButton_Click()
Dim SelCnt As Integer
Set pWorkspace = Workspace_Def
Set pEditor = Application.FindExtensionByName("ESRI Object Editor")
Dim pQueryFilter As IQueryFilter
Set pQueryFilter = New QueryFilter
Dim rs As ADODB.RecordSet
Dim rs2 As ADODB.RecordSet
Set rs = New ADODB.RecordSet
sql = "SELECT distinct " & sTableName & ".NAME" + _
" FROM " & sTableName + _
" WHERE " & sTableName & ".NAME <> ' ' AND " & sTableName & ".NAME IS NOT NULL ORDER BY " & sTableName & ".NAME;"
'" WHERE " & sTableName & ".NAME LIKE 'ß%' ORDER BY " & sTableName & ".NAME;"
Open "C:\report.txt" For Output As #1
Open "C:\comm.txt" For Input As #2
rs.Open sql, g_dbConn
If rs.EOF Then
MsgBox "Конец файла"
Exit Sub
Else
rs.MoveFirst
counter = 0
txtLog.Text = txtLog.Text + "Объединение сегментов речной сети..." + vbCrLf
txtLog.Text = txtLog.Text + "------------------------------------" + vbCrLf
Write #1, txtLog.Text
CountBefore = CountFeat
Do While Not rs.EOF
pQueryFilter.WhereClause = "NAME = '" + rs.Fields(0).Value + "'"
pFeatureSelection.SelectFeatures pQueryFilter, esriSelectionResultNew, False //Здесь ошибка
SelCnt = pFeatureSelection.SelectionSet.Count
If SelCnt < 2 Then
GoTo NextRiver
End If
pEditor.StartEditing pWorkspace
Dim pEnumFeature As IEnumFeature
Set pEnumFeature = pEditor.EditSelection
Call MergeFeatures(pEnumFeature, SelCnt)
pEditor.StopEditing (True)
Dim Comm As String
Line Input #2, Comm
Seek #2, 1
If Comm = "STOP" Then
If MsgBox("Выйти", vbYesNo) = vbYes Then Exit Sub
End If
NextRiver:
txtLog.Text = txtLog.Text + VBA.Str(counter + 1) + " река - " + rs.Fields(0).Value + " - " + VBA.Str(lCount) + " сегмнтов" + vbCrLf
Write #1, VBA.Str(counter + 1) + " река - " + rs.Fields(0).Value + " - " + VBA.Str(lCount) + " сегментов" + vbCrLf
lCount = 1
rs.MoveNext
counter = counter + 1
Loop
rs.Close
End If
CountAfter = CountFeat
txtLog.Text = txtLog.Text + "------------------------------------" + vbCrLf
Close #1
Close #2
End Sub