My question arised out of the accept answer here:
DataRow[] Aggregate Functions C#
In that answer, how is the "rows" object intialized?
EDIT: In my case, I have mydataset.Tables[0].Rows collection, from 开发者_如何学JAVAwhich I need to SUM a particular column.
Well you can create your own list of DataRow
List<DataRow> listOfRows = new List<DataRow>();
Or you can get collection of them from GridView.
var rows = gridView.Tables[0].Rows; //will return a collection of DataRows from your Gridview
Or from DataSet
var rows = dataSet.Tables[0].Rows;
Probably from a LINQ query like:
List<DataRow> rows = (from row in mydataset.Tables[0].AsEnumerable()
select row).ToList();
精彩评论