How can I display differently from the database a field from a record, after the execution of a SELECT statement?
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]
精彩评论