如何将%符号连接到Datatable列(int) [英] How to concatenate % symbol to Datatable column(int)
本文介绍了如何将%符号连接到Datatable列(int)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我的数据表的值类似于
Hi All,
I have a Datatable with values like
ID PercentofSales
1 0
2 25
3 50
4 75
这是我做的:
This is wat i do :
For Each dr As DataRow In m_dtPercentofSales.Rows
Me.cmbPercentofSales.Items.Add(dr("PercentofSales"))
Next
B我如何将%符号附加到PercentofSales列。我可以通过将列数据类型设置为Varchar来将%添加到SQL表中,但我不想这样做。请帮忙。
谢谢。
But how do i append % symbol to the PercentofSales column. I can add the % to the SQL Table by making the column Datatype as Varchar but i dont want to do that. Please help.
Thanks.
推荐答案
你可以在你的查询中这样做....
Hi,
Could you make this in your Query like this....
SELECT ID, CAST(PercentofSales AS VARCHAR(10))+'%' AS PercentofSales FROM yourtable
问候,
GVPrabu
Regards,
GVPrabu
试试这个
Try this
foreach (DataRow row in MyDataTable.Rows)
{
row["columnNameHere" Or index] = value;
}
希望这有帮助
Hope this helps
这篇关于如何将%符号连接到Datatable列(int)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文