c# - How to represent The SQL query in Linq -


I have SQL query but have difficulty in converting to linq. I'm new to LINQ.

The selection statement of my SQL is as follows: Select

  in CM.ParentCategoryID (Select from the CategoryID as CM.CategoryName as dbo.utblCategoryMaster from Dbo. UtblCategoryMaster where CategoryName = 'Events')   

I know this is simple and easy x.ParentCategoryID == objutblCategoryMaster; I have tried this selection from objutblCategoryMaster = {classID = objutblCategoryMaster.CategoryID, CategoryName = db.utblCategoryMasters.Where (x = gt) => results in the

  results at = db.utblCategoryMasters. CategorID & gt; ; Amp; x category name == "event")}; Return result. CoptoDataText ();    

"itemprop =" text ">

After getting involved with one you can get results. Results at

  = db.utblCategoryMasters .Join (db.utblCategoryMasters.Where (c => c.CategoryName == "Event"), cm = & gt; cm.ParentCategoryId, c = & Gt; c.CategoryId, (cm, c) => new {cms.schearti, cm range name});   

If you are using the unit framework and the navigation properties are set correctly, then you can make it something easier ... < pre> var results = db.utblCategoryMasters. where (cm = & gt; cm.ParentCategory.CategoryName == "event") .Select (cm = & gt; new {cm.CategoryId, cm.CategoryName});

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -