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
pRow.Store
Set pRow = pCursor.NextRow
Loop
End Sub
I get "Automation Error" at "Set pCursor = pTable.Update(pQueryFilter, False)" Why?