0

我有一个数据表。在该表中,我有名为 [Total Day]、[Present day] 和 [leave] 的列。数据如下:

[Total Day], [Present day], [leave]
   30           25             5
   30           26             4

现在我想将这三列连接到另一列中。我想要输出这样的东西:

[Total Day] [Present Day] [Leave]  [TotalDay    PresentDay  Leave]
30           25             5      30 VBCrLf    25 VBCrLf     5
30           26             4      30 VBCrLf    26 VBCrLf     4
4

2 回答 2

1
table.Columns.Add("TotalDay    PresentDay  Leave", GetType(String), "[Total Day] + '" & vbCrLf & "' + [Present Day] + '" & vbCrLf & "' + [Leave]")

假设方括号不是列名的一部分,如果是,则使用“[[Total Day\]]”等。详情请参见:http: //msdn.microsoft.com/en-us/library/ system.data.datacolumn.expression.aspx

于 2012-04-05T18:29:46.803 回答
0
SELECT [Total Day], [Present Day], [Leave], 
       [Total Day] + '\n' + [Present Day] + '\n' + [Leave] As [TotalDay PresentDay Leave]
FROM MyTable
于 2012-04-05T15:08:09.843 回答