Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to Combind two fields into one drop down

Status
Not open for further replies.

dhrehor

IS-IT--Management
Jun 16, 2005
23
US
Sorry for the newbie question, but I am just getting started.

I have a drop down list that I am trying to populate with data from two fields.

If in the dataTextField, I populate lastname, the drop down works fine and populates the lastname field in the drop down.

What I want is to do a lastname, firstname. MY SQL statement pulls the correct data, I just don't know how to get this into the drop down correctly.

Fields imported via the SQL statement ( lastname and firstname)

Also I am doing this in Visual Studio via C#.

Thanks

Don
 
You can modify your SQL clause like:

SELECT lastName + ', ' + firstNAme
AS name,
<other_fields>...
FROM <table_name>

... etc
 
The easiest method is to create a new field in tyour SQL Statement that is a combination of both fields and then bind your DropDownList display field to that combined field.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top