Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Dynamic use of Restriction Operator in a linq query

Dynamic use of Restriction Operator in a linq query

Scheduled Pinned Locked Moved LINQ
csharpdatabaselinq
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sayed Sajid
    wrote on last edited by
    #1

    Hi, This is my linq query, I wanted this query to dynamilcally fetch the fields mentioned after select{----------------------}; var res1 = from tbltrans in ctx.tblTransferDatas join tblemp in ctx.tblEmployees on tbltrans.EmployeeID equals tblemp.EmployeeID join tbldpt in ctx.tblDepts on tblemp.DeptID equals tbldpt.DeptID join tbldiv in ctx.tblDivisions on tbldpt.DivisionID equals tbldiv.DivisionID join tblreg in ctx.tblRegions on tbldiv.RegionID equals tblreg.RegionID join sites in ctx.tblSites on tbltrans.Site_No equals sites.Site_No join ters in ctx.tblTerminals on tbltrans.Ter_No equals ters.TerNo select new { tbltrans.TransferData_ID, tbltrans.ActionDate, tbltrans.CardSnr, tbltrans.Updated_to_Card_By_CP, tbltrans.Updated_to_Card_By_Ter, tbltrans.Deleted_By_CP, tbltrans.SiteTer_Type, tbltrans.Site_No, tbltrans.Ter_No, tblemp.BadgeNo, tblemp.FullName , tbldpt.DeptID, Dept = tblreg.RegionName + "/" + tbldiv.DivisionName + "/" + tbldpt.DeptName, sites.Site_Name, ters.Terminal_Name }; I wanted to add a dynamic where clause before select,I would appreciate any early replies. Many thanks in advance. regards Sajid

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups