c# - Fill DataTable using array of NewRows -


and help! i'm trying fill datatable before pulled in report microsoft reporting services.

i thought run (depending on how many rows there in "maintable", , assign each category , flush rows.add , repeat apparently cannot row.add same name newrow. here's have far. help!:

mydataset.essrow newess = mydataset.ess.newessrow();         (int = 0; < ds.tables["maintable"].rows.count; i++)         {             datarow drow = ds.tables["maintable"].rows[i];             if(convert.toint32(drow.itemarray.getvalue(9).tostring()) > shiftdelta)//checks if instance longer shift              {             newess.station = "7";             newess.switch ="7";             newess.start = drow.itemarray.getvalue(6).tostring();             newess.stop = drow.itemarray.getvalue(7).tostring();             newess.switchis = drow.itemarray.getvalue(8).tostring();             timespan t = timespan.fromseconds(convert.toint32(drow.itemarray.getvalue(9).tostring()));             newess.duration = string.format("{0:d2}h:{1:d2}m:{2:d2}s", t.hours, t.minutes, t.seconds);             mydataset.ess.rows.add(newess);                 }          } 

don't try add same row several times, instead create new row add in each iteration of loop. can done moving declaration of newess inside of loop rather outside of loop. beyond that, should move inside of if statement aren't creating new row if aren't going add one.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -