本文介绍了如何在查询两列时在查询中给出空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们,
我在使用Gridview工作在asp.net c#上工作。
我有我的数据库表中的数据,并在gridview中显示。
这里我想用空格连接两列。
这是我的代码
从ScheduleTable中选择(TrainCode + TrainName)为TrainNo
它显示MM2687,所以我需要它作为MM 2687
我需要在TrainCode和Train Name之间留一个空格。
请帮助
谢谢
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
推荐答案
SELECT [TrainCode] + ' ' + [TrainName] as TrainNo FROM ScheduleTable
这可能有效。
This may work.
这篇关于如何在查询两列时在查询中给出空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!