DropDownList w/ DataSource - How to Combine 2 Fields (LastName, FirstName)?
Posted on 2002-05-06
Ok, I am using Microsoft SQL With Stored Procedures. I run a Query that returns the First Name and Last Name of all the users in the Database. I then return that and try and fill a DropDownList with this Format "Last, First". I can get just one field to successfully fill, like Last Name, but I can't seem to figure out how to combine Last Name and First Name.
Here is some Code:
1. SQL Calling Stored Procedure
' Execute the command
Dim result As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
' Return the datareader result
2. Filling the DropDownList (The Code Below works for Last Name)
Me.ddlStudentDetail.DataSource = dbGradSite.StudentFullName()
Me.ddlStudentDetail.DataValueField = "LastName"
Me.ddlStudentDetail.DataTextField = "LastName"
Now, as I said before I want "LastName, FirsName". Any help/advice would be appreciated.