简体   繁体   English

在选择查询结果中插入空行

[英]Insert empty line in select query result

I want to get data from database in code behind c# in asp.net. 我想从ASP.NET中C#背后的代码中从数据库中获取数据。 I am trying to get two columns in one result and put it in one gridview column. 我试图在一个结果中获得两列,并将其放在一个gridview列中。 How to insert blank line between these two columns? 如何在这两列之间插入空白行? The command text is 命令文本为

"Select question + ': '+ answer from Questions .... ".

Is there any way to get the result like this: 有什么办法可以得到这样的结果:

question: 题:

answer (in new line). 答案(在新行中)。

Thanks a lot. 非常感谢。

If I understand your question correctly you want to create one coulmn from 2 column with question : on the first line and answer on the next. 如果我正确理解你的问题,你要创建从问题2列一个coulmn :在第一行,并回答下。 Then this might do the trick for you. 然后,这可能会帮您解决问题。

SELECT CONCAT(question, ':', CHAR(13)+CHAR(10) , answer) as QuesAns From TableName

or 要么

SELECT (question + ':' + (CHAR(13)+CHAR(10)) + answer) as QuesAns From TableName

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM