[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

how can I combine 2 columns from a dataset table as the datatextfield of a dropdown control?

Posted on 2011-03-24
3
Medium Priority
?
397 Views
Last Modified: 2012-05-11
Hi, I'm using asp.net 3.5, C# and sql 2005 exp
How can I combine LastName and FristName column of a dataset table, separated by a comma as the ddb Datatextfield?  So it should display something like:
LastName, Firstname
Thank you.
0
Comment
Question by:lapucca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 1000 total points
ID: 35213013

Not sure got your question completely
but I think you have two columns in database like Fristname and LastName
and you want to combine it in one and then bind it to dropdown control

Tehn in this case you can get it from database itself as combined in query like

Select LastName + '," + Firstname as Name from Tablename

and bind NAme column to Drop down
0
 
LVL 1

Assisted Solution

by:StellerSystems
StellerSystems earned 1000 total points
ID: 35213029
in your sql server 2005 view, i would concatenate the two fields into a new field called LastFirst or something like that, then just use that field for your control:

select Lastname, Firstname, LastName + ',' + Firstname LastFirst
From TableOfNames
order by Lastname, Firstname

then set your control accordingly

if either Lastname or  Firstname could be NULL, make sure you handle that or the whole string will be null:

isnull(LastName,'') + ',' + isnull(Firstname,'')
0
 

Author Closing Comment

by:lapucca
ID: 35213065
Thank you.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question