Hi,
I need to find a way to update some 400,000 rows of an in-memory datatable. Looping through rows is very slow.
here's the code I'm using:
Is there a faster way to do this?
Thanks,
Simran
I need to find a way to update some 400,000 rows of an in-memory datatable. Looping through rows is very slow.
here's the code I'm using:
Code:
protected virtual void SetEditStamps(ref DataSet ds)
{
int count = 0;
if ( ds != null )
{
foreach (DataTable dt in ds.Tables)
{
if ( dt.Columns.Contains(_dcnameEditId) && dt.Columns.Contains(_dcnameEditDate) )
{
// foreach (DataRow dr in dt.Select(null, null, DataViewRowState.ModifiedCurrent | DataViewRowState.Added))
string sEditID = BusinessLogicComponent._dcnameEditId;
string sEditDate = BusinessLogicComponent._dcnameEditDate;
int iEditID = dt.Columns[sEditID].Ordinal;
int iEditDate = dt.Columns[sEditDate].Ordinal;
for (int i = 0; i<dt.Rows.Count; i++)
{
// SetRowLevelEditStamps(dt.Rows[i]);
dt.Rows[i][iEditID] = _lastEditBy;
dt.Rows[i][iEditDate] = _lastEditOn;
count++;
}
}
}
}
}
Thanks,
Simran
Comment