![](/img/trans.png)
[英]How to concatenate string values and int values in one text box using rdlc report expression in c#
[英]How to concatenate two values into text box in c#?
我有两个值,我想将这些值转换为文本框。 我尝试的方式如下所述
string time="00";
int Result ="02";
textresult.Text=result+' '+time;//first way error result
textresult.Text=(CAST(Result AS varchar(50))+' '+CAST(time AS varchar(50)))//second way..syntax error.
我需要在文本框中输出02:00格式。 请建议一种解决这个问题的方法????
试试以下。
textresult.Text=string.Format("{0}:{1}",Result.ToString("D2"),time);
您的代码报告语法错误,因为有。 看来你正在使用C#像sql语法!
尝试这个:-
string time = "00";
int Result = 02;
textresult.Text=Result.ToString("D2") + ":" + time;
这可能有所帮助。
string time="00";
int Result =02;
textresult.Text = String.Format("{0}:{1}",Result.ToString("D2"),time);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.