Results 1 to 4 of 4

Thread: DataRow...Not getting it!

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216

    Thumbs down DataRow...Not getting it!

    I have a dataset filled with 1 and only 1 row in a table called Broadcasts.

    How do I read the value from the Title column? This errors out saying that there is no row at 0 or the same message if I change it to 1.

    Waz up?!

    Code:
    dsCRH.Tables("Broadcasts").Rows(0)("Title")

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    try this :
    VB Code:
    1. MessageBox.Show(dsCRH.Tables("Broadcasts").Rows(0).Item(0))

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    Originally posted by Pirate
    try this :
    VB Code:
    1. MessageBox.Show(dsCRH.Tables("Broadcasts").Rows(0).Item(0))

    cool got it thanks

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Or you could do something like this:
    Dim dr as DataRow
    dr = dsCRH.Tables("Broadcasts").Rows(0)

    MessageBox.Show(dr("ColumnName").ToString())

    I am not one hundred percent sure on the syntax for VB.Net, but I think I got it right (To lazy to check it...lol).

    Anyway, if you are only expecting one row back, why use the dataset object in the first place? You can just the DataRow object which holds only one row. Just a thought.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width