using (School_365Entities db = new School_365Entities()) { var Query = (from x in db.tbl_staticfielddetails where x.institutionid == insid select x.id).Count(); foreach (var item in Query) { cnt = Convert.ToInt32(item.ToString()); } }
Error foreach statement cannot operate on variables of type 'int' because 'int' does not contain a public definition for 'GetEnumerator'
var Query = (from x in db.tbl_staticfielddetails where x.institutionid == insid select x.id).Count();
int count = (from x in db.tbl_staticfielddetails where x.institutionid == insid select x.id).Count();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)