I have a table in Sql Server that contain an int field price that allow nulls.
I have created the following stored procedure:
CREATE PROCEDURE [dbo].[proc_test]
AS
select a.id, a.product, case when a.price is null then 0 else a.price end
from tblOne a
...
I have also created a linq to sql file that uses proc_test.
The problem is that auto generated linq to sql code in: designer.cs has a nullable price variable and Crystal Reports dosen’t allow nullable variables.
PS: I’m not allowed to change the structure of tblOne.
Use the IsNull() function instead of the case expression. Therefore change your stored procedure to be:
Note:
Coalesce is not suitable in this situation:
http://msdn.microsoft.com/en-us/library/ms190349.aspx