Dataset created in Code cannot be used in Crystal Reports designer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I've created a Dataset in code on my form based on an OLEDB provider also
created in code. I want to be able to use this dataset in a Crystal Report,
but the dataset is not listed in the report designer? I'm not sure how to
resolve this problem, any ideas are helpfull.

Thank you
 
You need to create an XSD that mimics this dataset created in code and
specify that as the datasource for your crystal report. That'll give you
various fields you can databind with on the report, then with a little C#
magic you can easily bind the dataset to the report.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
I like to use DataSet created at runtime as report data source. As you
already know, if it is not a strong named DataSet (no XSD file exist in
design time), it will not listed in report designer. There is a simple way
to solve this, though. You simply specify a dummy "SELECT..." SQL Statement
in the report designer as data source, which contains all the columns in you
DataSet. Say, you want a table in the dataset to be a report's source, which
has columns: "Persion", "LastName", "FirstName", "BirthDate", "Height".
Then, in the report designer, point the report source to a command with this
SQL Statement:

"SELECT '' AS Person,'' AS FirstName,'' AS LastName,NULL AS BirthDate,0.00
AS Height FROM AnyTable WHERE 1=2"

Of course this SQL won't grab any record from a database. You will PUSH your
own dataset at runtime to the report, right?
 
Back
Top