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. How to return a Dataset/DataTable or DataView from a LINQ query result

How to return a Dataset/DataTable or DataView from a LINQ query result

Scheduled Pinned Locked Moved LINQ
databaselinqcsharptutorialquestion
7 Posts 6 Posters 15 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
    sysmatrix
    wrote on last edited by
    #1

    I have the following codes. But, I want to change the return type so it can return either Dataset/DataTable or DataView. How I can do that? linqAdventureWorksDataContext is a class created by "LINQ to SQL class" using the O/R designer in VS2008. public IQueryable<TransactionHistory> getTransactionHist(Int32 productID) { linqAdventureWorksDataContext linqAW = new linqAdventureWorksDataContext(); var ProductTran = from m in linqAW.TransactionHistories where m.ProductID == productID select m; return ProductTran; }

    P K 2 Replies Last reply
    0
    • S sysmatrix

      I have the following codes. But, I want to change the return type so it can return either Dataset/DataTable or DataView. How I can do that? linqAdventureWorksDataContext is a class created by "LINQ to SQL class" using the O/R designer in VS2008. public IQueryable<TransactionHistory> getTransactionHist(Int32 productID) { linqAdventureWorksDataContext linqAW = new linqAdventureWorksDataContext(); var ProductTran = from m in linqAW.TransactionHistories where m.ProductID == productID select m; return ProductTran; }

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

      Try this[^] post on my blog.

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

      My blog | My articles

      L 1 Reply Last reply
      0
      • P Pete OHanlon

        Try this[^] post on my blog.

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

        My blog | My articles

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Just Like u can Use it OpenConnection sql=Select * from Dbo.MYtable cmd = new odbc.command(sql,conn) reader = cmd.executereader while reader.read //Execute command Text here end while It returns you Data View. Anubhava Dimri anubhava.prodata@gmail.com 9250168195:rose:

        P 1 Reply Last reply
        0
        • L Lost User

          Just Like u can Use it OpenConnection sql=Select * from Dbo.MYtable cmd = new odbc.command(sql,conn) reader = cmd.executereader while reader.read //Execute command Text here end while It returns you Data View. Anubhava Dimri anubhava.prodata@gmail.com 9250168195:rose:

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

          The OP asked how to do this in LINQ. How is this LINQ?

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

          My blog | My articles

          J R 2 Replies Last reply
          0
          • P Pete OHanlon

            The OP asked how to do this in LINQ. How is this LINQ?

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

            My blog | My articles

            J Offline
            J Offline
            Jorgen Sigvardsson
            wrote on last edited by
            #5

            Don't worry about it. Some things are lost in translation... :rolleyes:

            -- Kein Mitleid Für Die Mehrheit

            1 Reply Last reply
            0
            • P Pete OHanlon

              The OP asked how to do this in LINQ. How is this LINQ?

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

              My blog | My articles

              R Offline
              R Offline
              Roger Alsing 0
              wrote on last edited by
              #6

              He can alter it a bit to make it linq ;-)

              var sql = from s in new string[]{"Select * from Dbo.MYtable"}
              select s;

              cmd = new odbc.command(sql,conn)
              reader = cmd.executereader
              while reader.read

              That qualifies, dont it? , right, right? ;-)

              Blog: http://www.rogeralsing.com Projects: http://www.puzzleframework.com

              1 Reply Last reply
              0
              • S sysmatrix

                I have the following codes. But, I want to change the return type so it can return either Dataset/DataTable or DataView. How I can do that? linqAdventureWorksDataContext is a class created by "LINQ to SQL class" using the O/R designer in VS2008. public IQueryable<TransactionHistory> getTransactionHist(Int32 productID) { linqAdventureWorksDataContext linqAW = new linqAdventureWorksDataContext(); var ProductTran = from m in linqAW.TransactionHistories where m.ProductID == productID select m; return ProductTran; }

                K Offline
                K Offline
                Knowledgedeeds
                wrote on last edited by
                #7

                Watch it guys Knowledge Experts :cool: are Here with Solution

                Follow the Link

                http://www.blog.vimallakhera.com/BlogId_2073_BlogItem.aspx

                (Knowledge Experts) Vimal Lakhera, Senior Software Engineer Corbus (India) Pvt. Ltd. | A CMMi Level 5 Company Cell) (+91) 9818 511 428 E-Mail: info@vimallakhera.com | http://www.vimallakhera.com

                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