Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First of all, I want to update a table, not a feature class (no geographical information). I tried the following

Public Sub updateInSql(tableName As String, whereClause As String, field As String, value As String)

    ' get table
    Dim pTable As ITable: Set pTable = getTableFromSQL(tableName) ' this is my function that gets the table object (it works for sure)
    If (pTable Is Nothing) Then Exit Sub

    Dim pQueryFilter As IQueryFilter: Set pQueryFilter = New QueryFilter
    pQueryFilter.whereClause = whereClause
    If (whereClause = "") Then Set pQueryFilter = Nothing

    Dim pCursor As ICursor: Set pCursor = pTable.Update(pQueryFilter, False)
    Dim pRow As IRow: Set pRow = pCursor.NextRow
    Do Until pRow Is Nothing
        pRow.value(pRow.fields.FindField(field)) = value
        Set pRow = pCursor.NextRow

End Sub

I get "Automation Error" at "Set pCursor = pTable.Update(pQueryFilter, False)" Why?

share|improve this question
up vote 0 down vote accepted

I found it

Just change

pTable.Update(pQueryFilter, False)


pTable.Search(pQueryFilter, False)

and it works

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.