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. :)
Re: How to display a value field from a record
ImagePath = objDataSet.Tables(0).Rows(0).Item("Image")
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 :)