AnsweredAssumed Answered

I am trying to update value for a specific column in a sql server databse table by using below mentioned code but "pTable.UpdateSearchedRows" function in the end throws and error.  ERROR: ESRI error Invalid SQL syntax[[Microsoft][SQL Server Native Client

Question asked by jnautiyal_UDConline on May 28, 2018
Latest reply on Jun 8, 2018 by Hornbydd
public void UpdateTable()        {            IMxDocument pMxdoc = ArcMap.Application.Document as IMxDocument;            ESRI.ArcGIS.Carto.IFeatureLayer pFlayer = pMxdoc.ActiveView.FocusMap.Layer[0] as ESRI.ArcGIS.Carto.IFeatureLayer;            IDataset pDS = pFlayer.FeatureClass as IDataset;            IFeatureWorkspace pFWS = pDS.Workspace as IFeatureWorkspace;            ITable pTable = pFWS.OpenTable("dbo.tablename");              // Build the query filter.             IQueryFilter queryFilter = new QueryFilterClass();            queryFilter.WhereClause = "ColumnName= 'Value for this column'";            queryFilter.SubFields = "ColumnName for which i have to update the value";             // Find the position of the TERM field in the table.            int termPosition = pTable.FindField("ColumnName for which i have to update the value");             // Build the row buffer to store the new value(s).            IRowBuffer rowBuffer = pTable.CreateRowBuffer();            rowBuffer.set_Value(termPosition, "1");             // Update the matching rows.            pTable.UpdateSearchedRows(queryFilter, rowBuffer);         }

Outcomes