c# - Where does DataRowCollection.Add method insert the new row? -


i'm trying figure out datarowcollection.add(datarow row) inserts new row datatable. @ end of table, append? random?

also, want use while i'm looping through datatable. if condition exists, add new row containing different data run through loop end of datatable. there specific problems approach? how else might handle it?

edit: looping through .net datatable stored in memory. i'm not touching database original data stored during looping operation. datatable populated prior loop , not problem.

here relavant code:

 datatable machineandlastdate = new datatable(); //populate machineandlastdate    (int = 0; < machineandlastdate.rows.count; i++) {    lastfuturedate = datetime.parse(machineandlastdate.rows[i]["maxduedate"].tostring());    newdatetime = lastfuturedate.adddays(frequency);    //this new date created.    machineserial = machineandlastdate.rows[i]["machineserial"].tostring();     if (newdatetime < datetime.now)    {           machineandlastdate.rows.add(new string[] { machineserial,         newdatetime.adddays(frequency).tostring() });            continue;    }    ...removed irrelevancy... } 

is valid way add row end of datatable?

as far know, added end of collection.

if for loop through database, there shouldn't problem, if begin @ beginning of data table , finish @ end of or smth similar. however, loop through newly created data rows, , don't know whether want achieve this. problems if take foreach loop instead because cannot handle modifications of underlying collection.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -