更多的这是我的代码LINQ:查询结果不能列举不止一次
searchDataContext db = new searchDataContext();
var query = (from p in db.SearchFirst(city, area)
select new
{
ID = p.Id,
Address = p.address,
Level = p.agahilevel
});
int count =query.Count();
// records
var q = query.Skip(Convert.ToInt32(start)).Take(Convert.ToInt32(width));
if (q.Count() > 0)
{
int index = 0;
str += "[";
foreach (var row in q)
{
if (index == 0)
我在此代码
The query results cannot be enumerated more than once.
请检查并回答我有一个错误。
可能重复:[一个查询的结果不能枚举不止一次](http://stackoverflow.com/questions/5723555),[查询结果不能枚举不止一次](http://stackoverflow.com/questions/13611666) – mellamokb 2013-04-23 12:59:09
walther,我尝试你的答案befor.it不适合我。 – 8611670474 2013-04-23 13:01:00