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. Database & SysAdmin
  3. Database
  4. getting column from the dataset

getting column from the dataset

Scheduled Pinned Locked Moved Database
question
3 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.
  • D Offline
    D Offline
    dayakar_dn
    wrote on last edited by
    #1

    Hi, I have one dataset, that contain one table now how can i retrieve one column in that table can you send me all possible approachments

    N T 2 Replies Last reply
    0
    • D dayakar_dn

      Hi, I have one dataset, that contain one table now how can i retrieve one column in that table can you send me all possible approachments

      N Offline
      N Offline
      NICE TO MEET
      wrote on last edited by
      #2

      if u confirm only one table means ds.dt[tablename].columnname -

      1 Reply Last reply
      0
      • D dayakar_dn

        Hi, I have one dataset, that contain one table now how can i retrieve one column in that table can you send me all possible approachments

        T Offline
        T Offline
        turbochimp
        wrote on last edited by
        #3

        Do you really mean 'one column', or do you mean 'one value from a particular row'? If you really mean 'one column', then: DataColumn column = dataSet.Tables[string tableName].Columns[columnName] or DataColumn column = dataSet.Tables[int tableIndex].Columns[int columnIndex] If, however, you want the value stored for a particular column in a particular row in a table, then you need to index both the row and the column to get it: object value = dataSet.Tables[string tableName].Rows[int rowIndex][string columnName (,DataRowVersion rowVersion)] for example (the first method returns the current value in the described row's value list): public object GetValueInRow( DataSet ds, int tableIndex, int rowIndex, string columnName) { return GetValueInRow(ds, tableIndex, rowIndex, columnName, DataRowVersion.Current); } public object GetValueInRow( DataSet ds, int tableIndex, int rowIndex, string columnName, DataRowVersion rowVersion) { return ds.Tables[tableIndex].Rows[rowIndex][columnName, rowVersion] } Good luck.

        The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

        -- modified at 2:16 Monday 22nd May, 2006

        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