简体   繁体   English

如何在C#中的Crystal Report中向行添加单词

[英]How to add a word to a row in crystal Report in C#

I am doing an application in which I have to print some data using crystal report, 我正在做一个必须使用Crystal Report打印一些数据的应用程序,
for the data I am using MySql. 对于我正在使用MySql的数据。
In my database, I have a field which shows numbers of months so it is something like this: 在我的数据库中,我有一个显示月数的字段,所以它是这样的:

Table
User------- Prevision 用户-------预设
Test------- 3 MONTHS 测试------- 3个月

So, in my database my column prevision shows the number of months and what I need is to add MONTHS to the field in crystal report... PS: I don't want to add "MONTHS" in the database but only show it in the crystal report. 因此,在我的数据库中,我的列预置显示了月份数,我需要在水晶报表的字段中添加MONTHS ... PS:我不想在数据库中添加“ MONTHS”,而仅在水晶报表。 I can do it in datagrid easily but in crystal report I didn't make it. 我可以轻松地在datagrid中完成此操作,但在Crystal Report中却没有做到。 Thank you. 谢谢。

if you're saying you need to add the text "MONTHS" to your month value "3" and it is not currently there, you can create a Formula field in Crystal. 如果您要在月份值“ 3”中添加文本“ MONTHS”,但当前不存在该文本,则可以在Crystal中创建一个“公式”字段。 The formula would be something like: 公式如下:

{Tablename.Prevision} + " MONTH"

This will add the text MONTH to your prevision value for each row if you use the field within your Crystal report. 如果您使用Crystal报表中的字段,这会将文本MONTH添加到每一行的预置值中。

Just add concatenation in your SQL query, so it will return '3 months' instead of just '3' 只需在您的SQL查询中添加串联,那么它将返回“ 3个月”而不是“ 3个月”

something like this 像这样的东西

select prevision + ' months ' as Test from YOUR_TABLE_NAME 从YOUR_TABLE_NAME中选择prevision +“ months”作为测试

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

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