I want to display information from a database into a dropdown list. I want the option shown to come from two database fields.
This is what I have
Dim dbconn As SqlConnection = New SqlConnection("server=AM1ST_FS1;database=HRINFO;uid=sa;"
Dim selectCMD As SqlCommand = New SqlCommand()
selectCMD.CommandText = "Select * from employeeinfo"
selectCMD.Connection = dbconn
selectCMD.CommandTimeout = 30
dbconn.Open()
employee.DataSource = selectCMD.ExecuteReader()
employee.DataTextField = "firstName"
employee.DataValueField = "loginID"
employee.DataBind()
dbconn.Close()
I want the dataTextField to be something like this
employee.DataTextField = "firstName" & " " & "lastName"
Obviously this doesn't work. Any idea's on how to make it work???
This is what I have
Dim dbconn As SqlConnection = New SqlConnection("server=AM1ST_FS1;database=HRINFO;uid=sa;"
Dim selectCMD As SqlCommand = New SqlCommand()
selectCMD.CommandText = "Select * from employeeinfo"
selectCMD.Connection = dbconn
selectCMD.CommandTimeout = 30
dbconn.Open()
employee.DataSource = selectCMD.ExecuteReader()
employee.DataTextField = "firstName"
employee.DataValueField = "loginID"
employee.DataBind()
dbconn.Close()
I want the dataTextField to be something like this
employee.DataTextField = "firstName" & " " & "lastName"
Obviously this doesn't work. Any idea's on how to make it work???