on 10-04-2012 11:51 AM
Hi everyone I am getting the above error in my report. I use Crystal Reports with Visual Studios 2010 (Crystal Reports for .Net Framework 4 not sure which version).
Anyway I have some fields which can have Null values. I handle them using nullable properties like Int32?
I handle strings in the Reader:
ImeZaduzioca = (string)((Reader["PREZIME"] == DBNull.Value) ? null : Reader["PREZIME"]),
Now this all works for the Visual Studios part but when it comes to reports it gives me the error.
I searched online and found that you could set in report options to change database NULLs to DEFAULTS but I still got the same error.
I also found that the problem is that it doesn't support nullable properties so I tried changing them (since I have a separate class for the report) to non nullable and in the reader changing it but then I get a DBNull error.
I also tried changing my code to not change into nulls but into some allowed values:
ImeZaduzioca = (string)((Reader["PREZIME"] == DBNull.Value) ? string.Empty : Reader["PREZIME"]),
Or
ImeZaduzioca = (string)((Reader["PREZIME"] == DBNull.Value) ? "" : Reader["PREZIME"]),
But no luck same error shows up every time.
I am hoping you guys could help.
Does anyone have any idea how to solve this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For anyone interested in how I solved this:
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.