How to Add Row Number Column in Select query

Apr 24 2020 7:07 AM
Hello All , 
 
I have this query and  i need to add   Row Number Column  i try this code but not correct ,
 
 int count = 0;
var SourceIDS = (from main in db.RiskSources
join subCat in db.SubCategories on main.SubCategoryID equals subCat.ID
join description in db.Descriptions on main.DescriptionID equals description.ID
where Configrations.Any(a => a.sub_category_Id == main.SubCategoryID && a.category_Id == main.CategoryID)
select new
{
RiskSourceID = main.RiskSourceID,
No = ++count ,
status_record = "",
subCat_Name = subCat.Name,
description_Name = description.Name,
}).ToList();

Answers (1)