Results 1 to 3 of 3

Thread: How to display a value field from a record

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    7

    How to display a value field from a record

    Hello,

    I am a newbie and need help in displaying a value from the record in mobile asp.net form. I tried using this line ImagePath = objDataSet.Tables.Rows(0).Item("Image") but there seem to be an error that reads " 'Rows' is not a member of ' System.Data.DataTableCollection ' ". Here is the full code :

    Dim strSQL As String = "SELECT Image " & _
    "FROM Map " & _
    "WHERE Image_ID LIKE '" & Session("SSroad") & "'" & _
    "ORDER BY Image_ID"


    'Create data objects
    Dim objConn As New SqlConnection(strConn)
    Dim objCmd = New SqlCommand(strSQL, objConn)
    Dim objDataSet As DataSet = New DataSet
    Dim objDataAdapter As New SqlDataAdapter(objCmd)

    objDataAdapter.Fill(objDataSet)

    ImagePath = objDataSet.Tables.Rows(0).Item("Image")

    Appreciate the help.

  2. #2
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: How to display a value field from a record

    ImagePath = objDataSet.Tables(0).Rows(0).Item("Image")

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    7

    Re: How to display a value field from a record

    I tried using that method but it seems to display nothing. By using this code i was able to display the data that i want which is the path.

    ImageList.DataSource = objDataSet.Tables("Map").DefaultView
    ImageList.DataValueField = "Image"
    ImageList.DataTextField = "Image"
    ImageList.DataBind()

    How do i display assign the value to Dim As ImagePath As String. Appreciate the response

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