populate data to dropdowlist

S

susie

I have following code to populate a downdownlist
dynamically:
Dim myCmd As SqlCommand = New SqlCommand("SELECT LName,
FName FROM Manager", con)

Dim myReader As SqlDataReader = myCmd.ExecuteReader()


dropdown1.DataSource = myReader
dropdown1.DataValueField = "LName"
dropdown1.DataBind()


How can I populate dropdown1 with both FName and LName?
I tried
dropdown1.DataValueField = "LName"&" "&"FName"

It does not work.

Please help.

Thank you!
 
G

Guest

change your SQL statement to "SELECT LName+FName Name FROM
Manager" and change the code to
dropdown1.DataValueField = "Name"
Good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top