Im trying to bind a dropdown listbox with a table in SQL Server 7.0. Whenerver i use this code , i get value: "System.Data.Common.dbDataRecord".
Following is my code :
Sub Page_Load()
Dim strSqlCities as String = "Select city from city"
Dim strConnection as String = "server=Maxood;database=watal;user id=sa;password=;"
Dim objConn as New SqlConnection(strConnection)
Dim Cmd as New SqlCommand(strSqlCities,objConn)
objConn.Open()
cbocity.DataSource =Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
cbocity.DataBind()
objConn.Close()
End Sub
Could someone tell me what is wrong

Binding a dropdown listbox
PaulJackson1999
Compiler Error Message: BC30456: 'DisplayValue' is not a member of 'System.Web.UI.WebControls.DropDownList'.
Where are we wrong exctly Would you care to look in to it please, thanx
simon_wang
In ASP.NET they are called DataValueField and DataTextField. The latter is the one that is displayed.
paVF
I appreciate your response...thankyou
Rod Colledge
Wonder if you can tell me why there are 2 properties("DataValueField" and "DataTextField") and which one is better to use in which scenario.
Again thanks a lot for your great help.
AndersChen
cbocity.DataSource =Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
cboCity.DisplayValue = "TheColumnName"
cbocity.DataBind()
Nagendran Sellaiah