gfedz
asked on
Combine two database columns into one string in a drop down list
I have a drop down list that needs to be populated with an output of two different columns combined into one. I need to do this by the vb code behind and not query string so when the user selects a value in the dropdownlist I can make a query off that selection and resplit the two columns. So far I have this code and it just displays the Vehicle table but I need LocationDescription + Vehicle on one index.
ElseIf ddlSelectGSA.SelectedValue = "Joint" Then
ddlShow.Items.Clear()
ddlShow.Visible = True
sql = "SELECT LocationDescription, Vehicle FROM VehicleScheduler.dbo.tblVehicles ORDER BY LocationDescription"
myDataTable = New DataTable
myDataTable = getData(sql)
ddlShow.Items.Add(New ListItem("", "0"))
buildDD(sql, ddlShow)
ValReqDDLSelect.Visible = False
Hi
You get 2dattabase colums as one colum by concating them in procedur as
Select Column1+ " "+Column2 as YourColumn from table
and populate your dropdown list
You get 2dattabase colums as one colum by concating them in procedur as
Select Column1+ " "+Column2 as YourColumn from table
and populate your dropdown list
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's what I was looking for. Thank you.
http://www.codeproject.com/KB/custom-controls/multiColsDD_List.aspx