0
votes

I am looking to integrate Crystal Reports 2008 into a Windows Forms application. I would like to avoid direct connections from my client application to the database, while giving the user the "complete" report experience. Is it possible to for Crystal Reports 2008 to execute a report on a server into a client-side Windows Forms client control, similar to Microsoft Reporting Services?

3

3 Answers

1
votes

I don't know if it is exactly what you are after, but I can think of 2 ways you could fudge it :

  1. You can set up your report so that the 'database' is an XSD file, with no knowledge of the real backend. Then at runtime you push the data to the report.

// Create an instance at runtime appropriate to your environment - example only :

ReportClass rc = new ReportClass();

rc.Load(crystalReportFileName);

rc.SetDataSource(myIEnumerableData);

CrystalReportViewer crv = new CrystalReportViewer();

crv.ReportSource = rc;

// Display the crystal viewer.

2 - You could do the same as 1 on a server (regardless of the database approach) , then save the report and push it out to the client.

// Some Server-side service / method etc

public byte[] GetMyReport() {

ReportClass rc = new ReportClass();

rc.Load(crystalReportFileName);

rc.SetDataSource(myIEnumerableData);

rc.SaveAs(serverSideFile, True); // True is critical to save data with report

return .... // convert the created file to a byte array I suppose

}

// Client side

byte[] rep = Server. GetMyReport()

ReportClass rc = ..... // convert rep back to a crystal report

CrystalReportViewer crv = new CrystalReportViewer();

crv.ReportSource = rc;

0
votes

This isn't really what you're asking, but Crystal Reports Server does server-side reporting.

On the downside, it's annoyingly expensive.

http://www.businessobjects.com/product/catalog/crystalreports_server/

0
votes

I can't add a comment to the above as I have no points, but hope this helps.

Crystal Reports Server runs reports itself against the datasources, the idea being that clients without crystal reports or data access can run reports via the web, or the server runs scheduled reports and send the results out. I don't know if you can integrate it though.