in asp.net when i wanna create a listbox with text n values i do it like this:
however in vb.net i can't seem to find a way on how to create a combobox that extracts 2 types of data from the db and create it
i just wanna get the id n the name of the object from the database and put it in a listbox. how do i do it? and how do i retrieve the value from the listbox also?
VB.NET:
Dim objCommand As New SqlCommand(sqlStatement, sqlConn)
Dim objReader As SqlDataReader = Nothing
sqlConn.Open()
objReader = objCommand.ExecuteReader()
Dim DS As DataSet
Dim MyCommand As SqlDataAdapter
DropDownListRest.DataSource = objReader
DropDownListRest.DataTextField = "branch"
DropDownListRest.DataValueField = "restCode"
DropDownListRest.DataBind()
sqlConn.Close()
however in vb.net i can't seem to find a way on how to create a combobox that extracts 2 types of data from the db and create it
i just wanna get the id n the name of the object from the database and put it in a listbox. how do i do it? and how do i retrieve the value from the listbox also?