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. LINQ Query? [modified]

LINQ Query? [modified]

Scheduled Pinned Locked Moved LINQ
csharpdatabaselinqtutorialquestion
3 Posts 3 Posters 5 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.
  • M Offline
    M Offline
    murali_utr
    wrote on last edited by
    #1

    Hi, my requirement is need to construct query on fly and join is used. How to retrive data using Linq? Thanks in advance!

    Have A Nice Day! Murali.M

    modified on Thursday, February 14, 2008 5:33 AM

    P J 2 Replies Last reply
    0
    • M murali_utr

      Hi, my requirement is need to construct query on fly and join is used. How to retrive data using Linq? Thanks in advance!

      Have A Nice Day! Murali.M

      modified on Thursday, February 14, 2008 5:33 AM

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      OK. You need to provide a lot more information than that. You've told us almost nothing about your requirements, so I assume you must be an end-user.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      1 Reply Last reply
      0
      • M murali_utr

        Hi, my requirement is need to construct query on fly and join is used. How to retrive data using Linq? Thanks in advance!

        Have A Nice Day! Murali.M

        modified on Thursday, February 14, 2008 5:33 AM

        J Offline
        J Offline
        John ph
        wrote on last edited by
        #3

        If the tables in the database has a primary-key, foreign-key relation then the related column's are available as a sub-entity in the same linq object. for example Employee and Department table related through DepartmentID.here it goes...

        From tbl In LocalDataTable _
        Select tbl.EmployeeID, _
        tbl.FullName, _
        tbl.tblDepartment.Department, _
        tbl.DateOfJoining, _
        tbl.Salary

        this is one way of accessing the data from related tables. there are other better ways of doing the same.

        from tbl1 in EmpDataTable _
        from tbl2 in DeptDataTable _
        where tbl1.DepartmentID = tbl2.DepartmentID _
        select _
        tbl1.EmployeeID, _
        tbl1.FullName, _
        tbl2.Department, _
        tbl1.DateOfJoining, _
        tbl1.Salary

        (I'm a VB.NET Programmer)

        - Regards -
           J O N


        A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers


        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