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 rows

DataTable rows

Scheduled Pinned Locked Moved C#
questiontutorial
4 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.
  • N Offline
    N Offline
    NewToAspDotNet
    wrote on last edited by
    #1

    Hi All, I have a datatable with som rows. for example : activity date time a 01-01-07 12:00 b 01-01-08 13:00 c 01-01-07 12:00 As you can see, activity a and c have the same date and time. Now i have to filter those rows from the datatable and set them into a textbox. So how can i compare all rows with eachother and if they have the same date and time, then show them in a textbox???? Thanx.

    A E 2 Replies Last reply
    0
    • N NewToAspDotNet

      Hi All, I have a datatable with som rows. for example : activity date time a 01-01-07 12:00 b 01-01-08 13:00 c 01-01-07 12:00 As you can see, activity a and c have the same date and time. Now i have to filter those rows from the datatable and set them into a textbox. So how can i compare all rows with eachother and if they have the same date and time, then show them in a textbox???? Thanx.

      A Offline
      A Offline
      Anoop Unnikrishnan
      wrote on last edited by
      #2

      In the RowCreated event of GridView match each row from datatable to that of the time in the new created row. if it matches show it in textbox else leave it as it is. Take care that the activity is not matching.

      N 1 Reply Last reply
      0
      • A Anoop Unnikrishnan

        In the RowCreated event of GridView match each row from datatable to that of the time in the new created row. if it matches show it in textbox else leave it as it is. Take care that the activity is not matching.

        N Offline
        N Offline
        NewToAspDotNet
        wrote on last edited by
        #3

        Hi Anoop, Thanx for reply...wich gridview??? i don't use a gridview. it is a datatable from sqlserver table.

        1 Reply Last reply
        0
        • N NewToAspDotNet

          Hi All, I have a datatable with som rows. for example : activity date time a 01-01-07 12:00 b 01-01-08 13:00 c 01-01-07 12:00 As you can see, activity a and c have the same date and time. Now i have to filter those rows from the datatable and set them into a textbox. So how can i compare all rows with eachother and if they have the same date and time, then show them in a textbox???? Thanx.

          E Offline
          E Offline
          Evan St John
          wrote on last edited by
          #4

          Hi, Something like this might do it for ya... DataRow[] _dataRow1; DataRow[] _dataRow2; foreach(DataRow dr1 in whateverYouCalledThis.Rows) { _dataRow1 = dsYourDataSet.Tables[0].Select(“date”); foreach(DataRow dr2 in _dataRow) { _dataRow2 = dsYourDataSet.Tables[0].Select(“time”); } this.txtDate = _dataRow2[0]["date"].ToString(); this.txtTime = _dataRow2[0]["time"].ToString(); } I'm sure there are better ways to do this :) ~j

          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