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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Convert System.Data.DataSet to String

Convert System.Data.DataSet to String

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasehelpquestion
2 Posts 2 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.
  • G Offline
    G Offline
    gunnar66
    wrote on last edited by
    #1

    Hi I pretty new in asp.net and now using web matrix My problem is very easy, but I still can't work it out. I want to read from a record in a Access database, into a string variable. i Have tried this: Sub Button2_Click_1(sender As Object, e As EventArgs) dim ret ret= SjekkStatus("SOMETEXT") Label3.Text = ret End Sub Function SjekkStatus(ByVal navn As String) as System.Data.DataSet 'find record Return dataSet End Function This will not work because the function return a dataset. But i want to convert it to a string. How can i do this. Thx

    M 1 Reply Last reply
    0
    • G gunnar66

      Hi I pretty new in asp.net and now using web matrix My problem is very easy, but I still can't work it out. I want to read from a record in a Access database, into a string variable. i Have tried this: Sub Button2_Click_1(sender As Object, e As EventArgs) dim ret ret= SjekkStatus("SOMETEXT") Label3.Text = ret End Sub Function SjekkStatus(ByVal navn As String) as System.Data.DataSet 'find record Return dataSet End Function This will not work because the function return a dataset. But i want to convert it to a string. How can i do this. Thx

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi there. The DataSet object has a Tables collection, and each DataTable in the collection has a Rows collection of DataRow objects - I think you're looking for something like this:

      Sub Button2_Click_1(sender As Object, e As EventArgs)
      dim ret as string
      ret= SjekkStatus.Tables(0).Rows(0)("SOMETEXT")
      Label3.Text = ret
      End Sub

      Basically, the assignment line says "look inside the DataSet 'SjekkStatus', inside its first table, inside that table's first row, and retrieve the value from the column named 'SOMETEXT'."

      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