5281
asked on
Populate listbox with a dataset
Hi Experts,
I want to know how to populate a listbox with a dataset. I did the following code, but the listbox shows
System.Data.DataRowView
System.Data.DataRowView
I want to populate people's name in the listbox. How to do that?
************************** ********** ********
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CallDBConn()
Dim myCommand As New SqlDataAdapter("select * from tblUsers", objConn)
Dim ds As DataSet = New DataSet
myCommand.Fill(ds, "tblUsers")
lbFrom.DataSource = ds.Tables("tblUsers").Defa ultView
DataBind()
End Sub
I want to know how to populate a listbox with a dataset. I did the following code, but the listbox shows
System.Data.DataRowView
System.Data.DataRowView
I want to populate people's name in the listbox. How to do that?
**************************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CallDBConn()
Dim myCommand As New SqlDataAdapter("select * from tblUsers", objConn)
Dim ds As DataSet = New DataSet
myCommand.Fill(ds, "tblUsers")
lbFrom.DataSource = ds.Tables("tblUsers").Defa
DataBind()
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I didn't know what property I should use to display name. Thank u very much.