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. Web Development
  3. ASP.NET
  4. ASP .Net Datatable Problem

ASP .Net Datatable Problem

Scheduled Pinned Locked Moved ASP.NET
questioncsharphelp
12 Posts 6 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.
  • R Offline
    R Offline
    Rock Star
    wrote on last edited by
    #1

    Hi,    How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A                           DataTable B PID   |   CID                     CID      |   FID 1      |   1                           1         |      1 2      |   2                           4         |      8 4      |   16                        16         |   32 So after filtering I can have a output like DataTable C PID   |   FID 1      |   1 4      |   32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?

    Rock Star

    N A E A 4 Replies Last reply
    0
    • R Rock Star

      Hi,    How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A                           DataTable B PID   |   CID                     CID      |   FID 1      |   1                           1         |      1 2      |   2                           4         |      8 4      |   16                        16         |   32 So after filtering I can have a output like DataTable C PID   |   FID 1      |   1 4      |   32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?

      Rock Star

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      This isn't an ASP.NET question, its a database question. You're best bet would be to construct the query to return the results appropriately.


      I know the language. I've read a book. - _Madmatt

      A 1 Reply Last reply
      0
      • N Not Active

        This isn't an ASP.NET question, its a database question. You're best bet would be to construct the query to return the results appropriately.


        I know the language. I've read a book. - _Madmatt

        A Offline
        A Offline
        Abhishek Sur
        wrote on last edited by
        #3

        I think he is asking to manipulate Application end DataTable, not Database tables. :sigh:

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Windows7 API Code Pack
        Simplify Code Using NDepend
        Basics of Bing Search API using .NET

        N 1 Reply Last reply
        0
        • R Rock Star

          Hi,    How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A                           DataTable B PID   |   CID                     CID      |   FID 1      |   1                           1         |      1 2      |   2                           4         |      8 4      |   16                        16         |   32 So after filtering I can have a output like DataTable C PID   |   FID 1      |   1 4      |   32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?

          Rock Star

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          You need to recreate the new DataTable. Create Column using DataTable.Columns.Add(new DataColumn() To add a column To add a new Row use DataTable.NewRow() then add the row as DataTable.Rows.Add:rose:

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->** Windows7 API Code Pack
          Simplify Code Using NDepend
          Basics of Bing Search API using .NET

          R 1 Reply Last reply
          0
          • A Abhishek Sur

            I think he is asking to manipulate Application end DataTable, not Database tables. :sigh:

            Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


            My Latest Articles-->** Windows7 API Code Pack
            Simplify Code Using NDepend
            Basics of Bing Search API using .NET

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            I realize he is asking for that but it would be more effecient to do it at the database level.


            I know the language. I've read a book. - _Madmatt

            A 1 Reply Last reply
            0
            • N Not Active

              I realize he is asking for that but it would be more effecient to do it at the database level.


              I know the language. I've read a book. - _Madmatt

              A Offline
              A Offline
              Abhishek Sur
              wrote on last edited by
              #6

              Ok... No big deal buddy.. :thumbsup:

              Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


              My Latest Articles-->** Windows7 API Code Pack
              Simplify Code Using NDepend
              Basics of Bing Search API using .NET

              1 Reply Last reply
              0
              • A Abhishek Sur

                You need to recreate the new DataTable. Create Column using DataTable.Columns.Add(new DataColumn() To add a column To add a new Row use DataTable.NewRow() then add the row as DataTable.Rows.Add:rose:

                Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


                My Latest Articles-->** Windows7 API Code Pack
                Simplify Code Using NDepend
                Basics of Bing Search API using .NET

                R Offline
                R Offline
                Rock Star
                wrote on last edited by
                #7

                But I want only matching column of datatable A and datatable B in datatable C How can I do that?

                Rock Star

                1 Reply Last reply
                0
                • R Rock Star

                  Hi,    How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A                           DataTable B PID   |   CID                     CID      |   FID 1      |   1                           1         |      1 2      |   2                           4         |      8 4      |   16                        16         |   32 So after filtering I can have a output like DataTable C PID   |   FID 1      |   1 4      |   32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?

                  Rock Star

                  E Offline
                  E Offline
                  Ekvilibrium
                  wrote on last edited by
                  #8

                  Copy all DataTable to arrays, manipulate or filtering and create new DataTable

                  R 1 Reply Last reply
                  0
                  • E Ekvilibrium

                    Copy all DataTable to arrays, manipulate or filtering and create new DataTable

                    R Offline
                    R Offline
                    Rock Star
                    wrote on last edited by
                    #9

                    I was thinking of using select method. Is there any example for selecting data from two different datatables?

                    Rock Star

                    N 1 Reply Last reply
                    0
                    • R Rock Star

                      I was thinking of using select method. Is there any example for selecting data from two different datatables?

                      Rock Star

                      N Offline
                      N Offline
                      Nishant Singh
                      wrote on last edited by
                      #10

                      If you are using dotNetFramework 3.5 using Linq would be the easiest way

                      A 1 Reply Last reply
                      0
                      • N Nishant Singh

                        If you are using dotNetFramework 3.5 using Linq would be the easiest way

                        A Offline
                        A Offline
                        April Fans
                        wrote on last edited by
                        #11

                        Use the SQL sentence: SELECT A.PID,B.FID FROM A,B WHERE A.CID=B.CID, write it in Visual Studio or Procedure

                        April Comm100 - Leading Live Chat Software Provider

                        1 Reply Last reply
                        0
                        • R Rock Star

                          Hi,    How can I filter two different datatables in a single datatable? like consider I have following two datatables DataTable A                           DataTable B PID   |   CID                     CID      |   FID 1      |   1                           1         |      1 2      |   2                           4         |      8 4      |   16                        16         |   32 So after filtering I can have a output like DataTable C PID   |   FID 1      |   1 4      |   32 So in my filtered dattable I can have only matching results of datatable A and Datatable C? How can I do this using .Net datatable?

                          Rock Star

                          A Offline
                          A Offline
                          April Fans
                          wrote on last edited by
                          #12

                          ???Do you want to get a datatable?? StringBuilder strSQL= new StringBuilder("select A.* from A a inner join B on A.CID = B.CID"); SqlCommand cmd = new SqlCommand(strSQL.ToString(), conn, transaction); DataTable C= new DataTable(); C.Load(cmd.ExecuteReader(), LoadOption.Upsert);

                          April Comm100 - Leading Live Chat Software Provider

                          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