为要素类中满足条件的要素,批量赋予同一属性值,用什么方法比较快?

想为要素类中满足某条件的要素批量赋予同一属性值,循环遍历每个要素进行赋值的话,当数据量大时会比较慢,有没有更好的方法?
已邀请:

朱新颖

赞同来自:

【解决办法】:
可以使用ITable.UpdateSearchedRows方法,该方法可以满足上述需求。
publicvoidUpdateTerm(ITabletable)
{

// Build the query filter.

IQueryFilterqueryFilter =newQueryFilterClass();

queryFilter.WhereClause =Pop1996 >= 10000;

queryFilter.SubFields =TERM;

// Find the position of the TERM field in the table.

inttermPosition = table.FindField(TERM);

// Build the row buffer to store the new value(s).

IRowBufferrowBuffer = table.CreateRowBuffer();

rowBuffer.set_Value(termPosition,City);

// Update the matching rows.

table.UpdateSearchedRows(queryFilter, rowBuffer);

}

要回复问题请先登录注册