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. Visual Basic
  4. Filter data in dataset

Filter data in dataset

Scheduled Pinned Locked Moved Visual Basic
databasequestion
6 Posts 5 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.
  • D Offline
    D Offline
    dcode25
    wrote on last edited by
    #1

    I have this situation : I have created a dataset with wizard.The dataset has 2 tables : Table 1 Table2 Col11 (Primary key) Col21 (Primary key) Col12 Col22 Col13 Col23 The tables are related (Col11---Col22). Now i want to display only those records in table 1 that have one (ore more) rows in Table 2 with col22 <=0) How can i do this using only dataset ( not using SQL query in tableadapter)

    P N 2 Replies Last reply
    0
    • D dcode25

      I have this situation : I have created a dataset with wizard.The dataset has 2 tables : Table 1 Table2 Col11 (Primary key) Col21 (Primary key) Col12 Col22 Col13 Col23 The tables are related (Col11---Col22). Now i want to display only those records in table 1 that have one (ore more) rows in Table 2 with col22 <=0) How can i do this using only dataset ( not using SQL query in tableadapter)

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      You should be able to use the Select property to filter by col22<=0...

      "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

      D 1 Reply Last reply
      0
      • P Paul Conrad

        You should be able to use the Select property to filter by col22<=0...

        "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

        D Offline
        D Offline
        dcode25
        wrote on last edited by
        #3

        Thank you But i want to filter rows in Table 1 and the col22 columns is in table2 How to use select property in this case : Me.dataset.Table1.select ( "Col22>=0" ) - This cause an error ???

        _ 1 Reply Last reply
        0
        • D dcode25

          Thank you But i want to filter rows in Table 1 and the col22 columns is in table2 How to use select property in this case : Me.dataset.Table1.select ( "Col22>=0" ) - This cause an error ???

          _ Offline
          _ Offline
          _mubashir
          wrote on last edited by
          #4

          mysybet123 wrote:

          Me.dataset.Table1.select ( "Col22>=0" )

          Is it Me.dataset.Table(1).Select("Col22>=0") what is the error? Make sure 'Col22' is there in your dataset's table 1.


          Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.

          P 1 Reply Last reply
          0
          • D dcode25

            I have this situation : I have created a dataset with wizard.The dataset has 2 tables : Table 1 Table2 Col11 (Primary key) Col21 (Primary key) Col12 Col22 Col13 Col23 The tables are related (Col11---Col22). Now i want to display only those records in table 1 that have one (ore more) rows in Table 2 with col22 <=0) How can i do this using only dataset ( not using SQL query in tableadapter)

            N Offline
            N Offline
            Naji El Kotob
            wrote on last edited by
            #5

            Hi, Try to add an expression column to table 1 (for more details go to http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression(vs.80).aspx[^]) and assign it the following expression Count(child(RelationName).FieldName) Thus you can use the select statement of DataTable or a DataView object Note: You must have a relationship between tables Hope this helps :)

            NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice...

            1 Reply Last reply
            0
            • _ _mubashir

              mysybet123 wrote:

              Me.dataset.Table1.select ( "Col22>=0" )

              Is it Me.dataset.Table(1).Select("Col22>=0") what is the error? Make sure 'Col22' is there in your dataset's table 1.


              Mubashir Software Architect Storan Technologies Inc, USA Every job is a self portrait of the person who did it.

              P Offline
              P Offline
              progalx
              wrote on last edited by
              #6

              The col22 is in dataset table2 not in table1.Table2 and table1 have a relationship.

              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