DataSet.Select

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan

    DataSet.Select

    Is there any way to do a DataSet.Select( ) statement and use more than one
    selection "query"? For instance, instead of just selecting all rows where
    the IDNum is greater than 32 with DataSet.Select( "IDNum > 32"), select all
    rows where the IDNum > 32 and the Region = Midwest. Is this possible?


  • Jay B. Harlow [MVP - Outlook]

    #2
    Re: DataSet.Select

    Nathan,
    DataSet does not have a Select method, do you mean DataTable.Selec t?

    The only place I know of where the syntax that expressions in the DataSet OM
    is documented is the DataColumn.Expr ession help topic:



    There is an AND operator so you can use something like:

    Dim table As DataTable
    Dim rows() As DataRow
    rows = table.Select("I DNum > 32 And Region = 'Midwest')

    Hope this helps
    Jay

    "Nathan" <nkmacgregor.Ta keThisOut@softh ome.net> wrote in message
    news:O6xNBfC4DH A.876@TK2MSFTNG P10.phx.gbl...[color=blue]
    > Is there any way to do a DataSet.Select( ) statement and use more than one
    > selection "query"? For instance, instead of just selecting all rows where
    > the IDNum is greater than 32 with DataSet.Select( "IDNum > 32"), select all
    > rows where the IDNum > 32 and the Region = Midwest. Is this possible?
    >
    >[/color]


    Comment

    • Jan Tielens

      #3
      Re: DataSet.Select

      Sure, you can use the AND operator:

      myDataTable.Sel ect("IDNum > 32 AND Region = "MidWest")



      More info:



      Concatenation is allowed using Boolean AND, OR, and NOT operators. You can
      use parentheses to group clauses and force precedence. The AND operator has
      precedence over other operators. For example:

      (LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'


      --
      Greetz

      Jan Tielens
      _______________ _______________ __
      Read my weblog: http://weblogs.asp.net/jan


      "Nathan" <nkmacgregor.Ta keThisOut@softh ome.net> wrote in message
      news:O6xNBfC4DH A.876@TK2MSFTNG P10.phx.gbl...[color=blue]
      > Is there any way to do a DataSet.Select( ) statement and use more than one
      > selection "query"? For instance, instead of just selecting all rows where
      > the IDNum is greater than 32 with DataSet.Select( "IDNum > 32"), select all
      > rows where the IDNum > 32 and the Region = Midwest. Is this possible?
      >
      >[/color]


      Comment

      • Miha Markic

        #4
        Re: DataSet.Select

        Hi Jan,

        "Jan Tielens" <jan@no.spam.pl ease.leadit.be> wrote in message
        news:uQVZVjC4DH A.1724@TK2MSFTN GP09.phx.gbl...[color=blue]
        > Sure, you can use the AND operator:
        >
        > myDataTable.Sel ect("IDNum > 32 AND Region = "MidWest")[/color]

        Forgot singe parenthesis? :)
        .... Region = 'MidWest'")

        --
        Miha Markic - RightHand .NET consulting & software development
        miha at rthand com



        Comment

        • Jan Tielens

          #5
          Re: DataSet.Select

          Yes indeed! Thanks!
          myDataTable.Sel ect("IDNum > 32 AND Region = 'MidWest' ")
          --
          Greetz

          Jan Tielens
          _______________ _______________ __
          Read my weblog: http://weblogs.asp.net/jan


          "Miha Markic" <miha at rthand com> wrote in message
          news:ugHjAsC4DH A.2700@tk2msftn gp13.phx.gbl...[color=blue]
          > Hi Jan,
          >
          > "Jan Tielens" <jan@no.spam.pl ease.leadit.be> wrote in message
          > news:uQVZVjC4DH A.1724@TK2MSFTN GP09.phx.gbl...[color=green]
          > > Sure, you can use the AND operator:
          > >
          > > myDataTable.Sel ect("IDNum > 32 AND Region = "MidWest")[/color]
          >
          > Forgot singe parenthesis? :)
          > ... Region = 'MidWest'")
          >
          > --
          > Miha Markic - RightHand .NET consulting & software development
          > miha at rthand com
          > www.rthand.com
          >
          >[/color]


          Comment

          • Cor

            #6
            OT: Re: DataSet.Select

            Hi Miha,

            You have to be consequent, I do not do it with JayB, you saw it

            :-)

            Cor


            Comment

            • Armin Zingler

              #7
              Re: DataSet.Select

              "Nathan" <nkmacgregor.Ta keThisOut@softh ome.net> schrieb[color=blue]
              > Is there any way to do a DataSet.Select( ) statement and use more than
              > one selection "query"? For instance, instead of just selecting all
              > rows where the IDNum is greater than 32 with DataSet.Select( "IDNum >
              > 32"), select all rows where the IDNum > 32 and the Region = Midwest.
              > Is this possible?[/color]

              You mean Datatable.selec t? Yes, you can use the And operator. See the help
              for System.Data.Dat aColumn.Express ion explaining the syntax.


              --
              Armin




              Comment

              • Miha Markic

                #8
                Re: Re: DataSet.Select


                "Cor" <non@non.com> wrote in message
                news:eLbZxwC4DH A.1936@TK2MSFTN GP12.phx.gbl...[color=blue]
                > Hi Miha,
                >
                > You have to be consequent, I do not do it with JayB, you saw it[/color]

                Overlooked that :)
                [color=blue]
                > :-)[/color]

                I know that Jan knows what he is writting and it was only a typo :)

                --
                Miha Markic - RightHand .NET consulting & software development
                miha at rthand com



                Comment

                • CJ Taylor

                  #9
                  OT: Re: DataSet.Select


                  "Miha Markic" <miha at rthand com> wrote in message
                  news:ugHjAsC4DH A.2700@tk2msftn gp13.phx.gbl...[color=blue]
                  > Hi Jan,
                  >
                  > "Jan Tielens" <jan@no.spam.pl ease.leadit.be> wrote in message
                  > news:uQVZVjC4DH A.1724@TK2MSFTN GP09.phx.gbl...[color=green]
                  > > Sure, you can use the AND operator:
                  > >
                  > > myDataTable.Sel ect("IDNum > 32 AND Region = "MidWest")[/color]
                  >
                  > Forgot singe parenthesis? :)[/color]

                  I believe the correct response was "single quote marks". The judges would
                  have also accepted apostrophe... yes.. apostrophe. =)

                  again... my 2 useless cents.

                  [color=blue]
                  > ... Region = 'MidWest'")
                  >
                  > --
                  > Miha Markic - RightHand .NET consulting & software development
                  > miha at rthand com
                  > www.rthand.com
                  >
                  >[/color]


                  Comment

                  • Jay B. Harlow [MVP - Outlook]

                    #10
                    Re: Re: DataSet.Select

                    Cor,
                    Doh! I see my sample had a typo also...

                    Odd that both samples had small typos... It must of been the phase of the
                    moon, yea that's it ;-)

                    Jay


                    "Cor" <non@non.com> wrote in message
                    news:eLbZxwC4DH A.1936@TK2MSFTN GP12.phx.gbl...[color=blue]
                    > Hi Miha,
                    >
                    > You have to be consequent, I do not do it with JayB, you saw it
                    >
                    > :-)
                    >
                    > Cor
                    >
                    >[/color]


                    Comment

                    • Nathan

                      #11
                      Re: DataSet.Select

                      Thanks for all the input -- this will make a lot of things easier for me. :)


                      Comment

                      • Miha Markic

                        #12
                        Re: Re: DataSet.Select

                        Hi,

                        "CJ Taylor" <nospam@blowgoa ts.com> wrote in message
                        news:100t7ukfn2 h7l17@corp.supe rnews.com...[color=blue]
                        >
                        > "Miha Markic" <miha at rthand com> wrote in message
                        > news:ugHjAsC4DH A.2700@tk2msftn gp13.phx.gbl...[color=green]
                        > > Hi Jan,
                        > >
                        > > "Jan Tielens" <jan@no.spam.pl ease.leadit.be> wrote in message
                        > > news:uQVZVjC4DH A.1724@TK2MSFTN GP09.phx.gbl...[color=darkred]
                        > > > Sure, you can use the AND operator:
                        > > >
                        > > > myDataTable.Sel ect("IDNum > 32 AND Region = "MidWest")[/color]
                        > >
                        > > Forgot singe parenthesis? :)[/color]
                        >
                        > I believe the correct response was "single quote marks". The judges would
                        > have also accepted apostrophe... yes.. apostrophe. =)[/color]

                        Ouch. I'll had to improve my english ;-)

                        --
                        Miha Markic - RightHand .NET consulting & software development
                        miha at rthand com



                        Comment

                        Working...