0

I'm new to LINQ and Entity Framework for that matter. I'm using data from MySQL to write to an Excel worksheet. Basic arrays are the fastest way to bulk write to worksheets. So my question is, what would the fastest way be to populate an array? Using LINQ? My tables in MySQL are made up of composite keys so I would select records based on a few criteria.

I got to the point where I size the array:

var rows = (from o in context.HoldingsEntitySet
            where o.AccountNumber == accountNumber 
            select o).Count();

Then I create the array:

var holdingsArray = new object[rows, 4];

Any help would be greatly appreciated because I'm a little stumped on how to do this!

thanks, Justin

4

1 回答 1

1

尝试这个:

var rows = (from o in context.HoldingsEntitySet
            where o.AccountNumber == accountNumber 
            select o);

var holdingarray = rows.ToArray();

如果这不起作用,您可以创建数组,然后遍历行,填充数据。

于 2013-10-31T14:05:50.870 回答