开发者

How can I display differently from the database a field from a record, after the execution of a SELECT statement?

开发者 https://www.devze.com 2023-03-26 06:44 出处:网络
I created a Crystal Repor开发者_StackOverflow社区ts report viewer in my WindowsForm application. When the form that contains the report viewer is loaded, the data is loaded into the report using the a

I created a Crystal Repor开发者_StackOverflow社区ts report viewer in my WindowsForm application. When the form that contains the report viewer is loaded, the data is loaded into the report using the a fill method created from the TableAdapter Query Configuration Wizard. There is a column in my database which the type is a single bit. So when the report loads, it shows True or False, depending of what is saved in the database. I would like to know how to display the string "Cheque" in the report when the field is set to True and the string "Duplicata" when the field is set to false. Thank you.


You can alter the SQL that the TableAdapter uses to format the result for you, or you could probably use Crystal Reports to do the formatting.

If you wanted to do it in the actual SQL statement, something like the following would work

SELECT (CASE [ColumnName] WHEN 1 THEN 'Cheque' ELSE 'Duplicata' END) as [AliasName]
FROM [TableName]
0

精彩评论

暂无评论...
验证码 换一张
取 消