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. C#
  4. datatable filter

datatable filter

Scheduled Pinned Locked Moved C#
question
5 Posts 3 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.
  • A Offline
    A Offline
    abcurl
    wrote on last edited by
    #1

    I have a datatable(code behind datatable class) that contains a column with the name aa which have ulphanumeric values. Is there any way to find those rows having numeric values onlywithout doing iteration ?

    G 1 Reply Last reply
    0
    • A abcurl

      I have a datatable(code behind datatable class) that contains a column with the name aa which have ulphanumeric values. Is there any way to find those rows having numeric values onlywithout doing iteration ?

      G Offline
      G Offline
      Greg Chelstowski
      wrote on last edited by
      #2

      The Select method of the DataTable class allows you to do just that, using pseudo T-SQL. It returns an array of DataRow. E.g.:

      DataRow[] results = yourDataTable.Select("aa=15");

      var question = (_2b || !(_2b));

      A 1 Reply Last reply
      0
      • G Greg Chelstowski

        The Select method of the DataTable class allows you to do just that, using pseudo T-SQL. It returns an array of DataRow. E.g.:

        DataRow[] results = yourDataTable.Select("aa=15");

        var question = (_2b || !(_2b));

        A Offline
        A Offline
        abcurl
        wrote on last edited by
        #3

        Thanks for replying.. :)

        Greg Chelstowski wrote:

        DataRow[] results = yourDataTable.Select("aa=15");

        I have to check it at runtime, and there is no static value as written by you in query. the datatable can have any number of both numeric, alphanumeric records. Please suggest something.

        G 1 Reply Last reply
        0
        • A abcurl

          Thanks for replying.. :)

          Greg Chelstowski wrote:

          DataRow[] results = yourDataTable.Select("aa=15");

          I have to check it at runtime, and there is no static value as written by you in query. the datatable can have any number of both numeric, alphanumeric records. Please suggest something.

          G Offline
          G Offline
          Greg Chelstowski
          wrote on last edited by
          #4

          abcurl wrote:

          I have to check it at runtime

          ???

          abcurl wrote:

          and there is no static value as written by you in query

          Then use variables. And by static I'm sure you meant hard-coded.

          abcurl wrote:

          the datatable can have any number of both numeric, alphanumeric records.

          Use single quotes in the query then! Now, once you actually got your DataRow array, I'm sure you'll be asking next how to extract values from it. Look, do some reading on MSDN, there are a million tutorials and examples on the .Select method of DataTable.

          var question = (_2b || !(_2b));

          K 1 Reply Last reply
          0
          • G Greg Chelstowski

            abcurl wrote:

            I have to check it at runtime

            ???

            abcurl wrote:

            and there is no static value as written by you in query

            Then use variables. And by static I'm sure you meant hard-coded.

            abcurl wrote:

            the datatable can have any number of both numeric, alphanumeric records.

            Use single quotes in the query then! Now, once you actually got your DataRow array, I'm sure you'll be asking next how to extract values from it. Look, do some reading on MSDN, there are a million tutorials and examples on the .Select method of DataTable.

            var question = (_2b || !(_2b));

            K Offline
            K Offline
            Kaushal Arora
            wrote on last edited by
            #5

            If possible try to use the Regex. May be it helps solving your problem.

            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