cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports 2008 does not Support LINQ or Nullable<T> for .NET

Former Member
0 Kudos

I am 99% certain the problem below is correct, however it would be nice if someone at SAP/BusinessObjects/CrystalReports would confirm it.

PROBLEM: If you call SetDataSource() with an IEnumerable<T>, the Crystal Reports engine wants to convert it into a DataSet. However if there are any Nullable<T> parameters on any objects it fails with the error message below. A Link.Table is different from a DataTable in that it supports Nullable types.

QUESTION: Is there a "best practice" workaround for this? Is this going to be addressed in an upcoming release?

DataSet does not support System.Nullable&lt;&gt;.

Edited by: Chris Marsh on Sep 29, 2008 10:08 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

SetDataSource is designed to take a DataSet or DataTable object. I think someone mentioned to me that they managed to get an array object of some sort to work. As far as I know, no other objects (enumerations, lists, entities, tables that are not of type System.Data.DataTable, etc) are supported or have been hacked into working at this point. I don't know if/when this is planned for a future release.

Former Member
0 Kudos

Hi, June 2011,

the problem displayed below is still existing. Is ther a workararound to use IEnumerable containing properties typed as Nullable<T> ?

Best regards.

Samuel

Former Member
0 Kudos

There a workaround if you use an ado.net entity data model, copy a table you want to use and then mark each field as nullable = false

you should then be able to use linq.

Answers (1)

Answers (1)

Former Member
0 Kudos

SetDataSource() has 5 overloads each have one parameter:

DataSet

DataTable

IDataReader

IEnumerable

object

So, while a method is available to pass an IEnumerable, any object passed that does not convert to a DataSet will result in an error being thrown.

Bottom line is that until SetDataSource is re-written to work without converting to a DataSet, LINQ will only be supported as long as there are no nullable Foreign Keys or Columns.

Mark me down as one that STRONGLY wishes this be addressed as soon as possible in the next possible release of CR.