First I know C# not VB but a little
I want to report my database with Microsoft Sql Server Report Service (it's better to say: the visual studio 2010 default reporting tools) for a windows form application.
In a matrix table I have a column "result" that every time contain a float value between 0 and 20 OR code 75 or 85. I want to show result value if result is between 0 and 20. In other case if result is 75, I want to report show string1 and if result is 85 show string2. So I wrote my VB function in Report Properties window in code section. this is my code
Function result_state(ByVal result AS single) AS string
IF (result == 85.00) then
return "string2"
ELSEIF (result == 75.00) then
return "string1"
ELSE
reutrn System.Convert.Tostring(result)
END IF
END Function
Then I changed the column value to:
=Code.result_state(Sum(Fields!result.Value))
Visual studio says that the columns Expression has error. In Expression window the "result_state" underlined red and in running application following error occure:
Error 1 There is an error on line 1 of custom code: [BC30201] Expression expected. D:\projects\faqih\faqih\classrpt.rdlc faqih
But program still working successfully and shows the report but 75 and 85 insteed string1 and string2.
Is my VB script is wrong?
Has my script usage mistake?
Or this is not correct solution for this problem?