Last post Jan 27, 2016 11:13 PM by madjester
Jan 27, 2016 12:36 PM|madjester|LINK
Hi, I don't know if this the right forum for my question but here goes. I am trying to create a report in SSRS by adding filters to my dataset which has the following query.
Select Name, Price, Quantity, Color, Size From Merchandises Order By Name
Below are the Tablix Properties settings for the filters
I am getting the error, "cannot compare data of types system.decimal and system.double" when I preview the report. In my Merchandises database table, data in the Price column are of type Decimal but inside of the Tablix Properties Price is of type Float.
I tried to cast the number 100 to type Decimal as shown below
Value = CDbl(100)
but it is not working. Is the type mismatch the cause of the error? If so, how can I convert the datatype of Price from Float to Decimal? Thanks in advance.
Jan 27, 2016 11:13 PM|madjester|LINK
It turned out I misunderstood the error message; I thought that by default SSRS in Visual Studio converts data of type Decimal coming from the database into Double and that is not the case. Instead, what happened was the data from the database is not modified
but the value I entered for the Value property of the filter in SSRS is converted into Double. When it is used in the comparison with the Decimal values in the database, it fails. I solved this problem by using the fx expression below.
This casts the number 100 as a Decimal and now everything works as expected.