Simply use the ToList method of your query.
crystal.SetDataSource(products.ToList());
SetDataSource takes an IEnumerable parameter also.
Alex Starke wrote:
LINQ2SQL and Crystal Reports
18-Dec-07
Hi folks
I play a little bit around with LINQ and found the problem, that I can no
print crystal reports directly from a LINQ query
Example with a formerly Dataset
crystal.SetDataSource(dataset)
Now with LINQ
var products = from p in db.product
select p
crystal.SetDataSource(products)
This doesn't work. Can anyone explain how to resolve this issue
Best regard
Alex
Previous Posts In This Thread:
LINQ2SQL and Crystal Reports
Hi folks
I play a little bit around with LINQ and found the problem, that I can no
print crystal reports directly from a LINQ query
Example with a formerly Dataset
crystal.SetDataSource(dataset)
Now with LINQ
var products = from p in db.product
select p
crystal.SetDataSource(products)
This doesn't work. Can anyone explain how to resolve this issue
Best regard
Alex
I'm sorry, but I thought that some else got the same problem and know a quick
I'm sorry, but I thought that some else got the same problem and know a
quick solution
If I do a crystal.SetDataSource(products); I get the following runtime error
System.NotSupportedException : "DataSet does not support System.Nullable<>.
So it seems to be clear, that the System.Linq.IQueryable<products> has to be
coverte
to Dataset. But I have no idea how or if there is a better solution
Best regard
Ale
Re: LINQ2SQL and Crystal Reports
That doesn't seem *particularly* clear to me... it's unclear why
DataSet is getting involved at all if you're not creating a DataSet..
--
Jon Skeet - <
[email protected]
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skee
World class .NET training in the UK:
http://iterativetraining.co.uk
Re: LINQ2SQL and Crystal Reports
Hi
--
Ignacio Machi
http://www.laceupsolutions.co
Mobile & warehouse Solutions
Just because SetDataSource receive an object instance it does not mean you
can pass anything. AFAIK you need to pass a DataSet. I'm not sure it can
even use a List<T>
You have to convert your products collection in a dataset first.
This is not clear to me. ;-) The CrystalReports.
This is not clear to me. ;-) The CrystalReports.SetDataSource() just accept
datasets (as far as I know)
But I try to use a System.Nullable<> so crystal doesn't accept this kind of
datasource
I don't know a better solution insted of cast the System.Nullable<> to a
dataset
Do you have a better idea ?
The engine of crystal reports must use a DataSet internally when converting
The engine of crystal reports must use a DataSet internally when
converting the results of IEnumerable to something the report can bind to
(which make some sort of sense, since the other overloads of SetDataSource
take a DataSet/DataTable, the implementation ^probably^ does some conversion
on the IEnumerable to a DataSet and then passes it to an overload)
--
- Nicholas Paldino [.NET/C# MVP
- (e-mail address removed)
Hi,At least in the version shipped with 1.1 you have to use a Dataset.
Hi
At least in the version shipped with 1.1 you have to use a Dataset. So you
had to do the conversion yourself.
I do not thing it was changed in 2.2 though.
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
message
Re: LINQ2SQL and Crystal Reports
Well, it would really help if you would give more information. "This
does not work" does not really give us much to go on.
Jon
Submitted via EggHeadCafe - Software Developer Portal of Choice
DataContractSerializer Basics
http://www.eggheadcafe.com/tutorial...c-94d2f3b1b265/datacontractserializer-ba.aspx