Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

Iam working on asp.net c# using Gridview.

I have data in my database table, and am displaying in gridview.

here i want to concat two columns using space.

This is my code

Select (TrainCode + TrainName) as TrainNo from ScheduleTable

It displays MM2687 , so i need it as MM 2687
I need a single space between TrainCode and Train Name.

Please help

Thanks
Posted

1 solution

Try like this
SQL
SELECT  [TrainCode] + ' ' + [TrainName] as TrainNo  FROM ScheduleTable

This may work.
 
Share this answer
 
Comments
Member239258 20-Jan-14 1:46am    
Thank you so much Gitanjali Singh, its working.
Gitanjali Singh 20-Jan-14 1:48am    
Please accept it as solution.:)
Karthik_Mahalingam 20-Jan-14 1:52am    
if it works, pls mark it as answer, so that other users wont reply for this question unnecessarily
Sampath Lokuge 20-Jan-14 1:56am    
+ 5 :)
Gitanjali Singh 20-Jan-14 2:09am    
Thanks Sampath :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900