Combining two db columns in one dropdown list
-
Hi! I'm having a problem whit my page. I have a sql db, and I want to combine to columns, "lastname" and "firstname", from my "user" table. I want to put the the combined two colums in one dropdownlist. This is my sql query: SELECT DISTINCT u.UserID, Firstname, Lastname FROM [User] u, Course_User cu WHERE cu.UserID=u.UserID Does anyone have a suggestion on how i can solve this?
-
Hi! I'm having a problem whit my page. I have a sql db, and I want to combine to columns, "lastname" and "firstname", from my "user" table. I want to put the the combined two colums in one dropdownlist. This is my sql query: SELECT DISTINCT u.UserID, Firstname, Lastname FROM [User] u, Course_User cu WHERE cu.UserID=u.UserID Does anyone have a suggestion on how i can solve this?
-
Hi! I'm having a problem whit my page. I have a sql db, and I want to combine to columns, "lastname" and "firstname", from my "user" table. I want to put the the combined two colums in one dropdownlist. This is my sql query: SELECT DISTINCT u.UserID, Firstname, Lastname FROM [User] u, Course_User cu WHERE cu.UserID=u.UserID Does anyone have a suggestion on how i can solve this?
What Suzanne said is a good idea. If you want columnar data, however, take a look at Multi-Column ComboBox[^] here on CP. It should give you some ideas and seems to already be data-bindable.
Microsoft MVP, Visual C# My Articles
-
You could change the query so it returns the combined first and last names. SELECT DISTINCT u.UserID, Firstname + ' ' + Lastname FROM [User] u, Course_User cu WHERE cu.UserID=u.UserID If I had a better memory I would remember more.
-
You could change the query so it returns the combined first and last names. SELECT DISTINCT u.UserID, Firstname + ' ' + Lastname FROM [User] u, Course_User cu WHERE cu.UserID=u.UserID If I had a better memory I would remember more.
Thanks Suzanne! It worked great! :)