This is my code
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)
I have an error in this code
The query results cannot be enumerated more than once.
please check that and answer me.