G
Guest
I have an employee table in a SQL Server database
I know how to bind data into a drop down list for a Field Name called State.
strSQL = "Select StateAbbreviation + ' - ' + StateName as StateInfo, StateAbbreviation From US_State"
objAdapter = New SqlDataAdapter(strSQL, objConnection)
objAdapter.Fill(objDataSet, "USState")
lstState.DataSource = objDataSet
lstState.DataMember = "USState"
'lstState.DataTextField = "StateInfo"
lstState.DataValueField = "StateInfo"
lstState.DataBind()
After I bind it, it shows 52 states in the drop down box...
but when I retrieve the data using dataset, how am i able to show TX on the drop down list instead of showing AK all the time
Also, how am i able to add a blank record for a drop down list since i don't want use have to choose a state...that means the drop down list showing 53 (52 states + 1 blank value)
Thanks... they have been drving me crazy for the whole day... VB6 is much easier...
I know how to bind data into a drop down list for a Field Name called State.
strSQL = "Select StateAbbreviation + ' - ' + StateName as StateInfo, StateAbbreviation From US_State"
objAdapter = New SqlDataAdapter(strSQL, objConnection)
objAdapter.Fill(objDataSet, "USState")
lstState.DataSource = objDataSet
lstState.DataMember = "USState"
'lstState.DataTextField = "StateInfo"
lstState.DataValueField = "StateInfo"
lstState.DataBind()
After I bind it, it shows 52 states in the drop down box...
but when I retrieve the data using dataset, how am i able to show TX on the drop down list instead of showing AK all the time
Also, how am i able to add a blank record for a drop down list since i don't want use have to choose a state...that means the drop down list showing 53 (52 states + 1 blank value)
Thanks... they have been drving me crazy for the whole day... VB6 is much easier...