Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to cast InfoObject to Report in .NET

Status
Not open for further replies.

acarruth

Programmer
Sep 7, 2003
34
0
0
US
Hi there,

For the life of me, I can't seem to cast an InfoObject to a CrystalEnterprise.Enterprise.Desktop.Report in .NET. Even with the sample code, it says the cast is not valid.. I've seen other references to this on the net, but no solution.

Has anyone seen or solved this issue?

Thanks!

Allan
 
I'm not having any problem with it - and I'm using it in several places. Here's a sample of the code that I'm using:
Code:
InfoObjects rptObj;
Report rpt;
string query = "Select * "
             + " From CI_INFOOBJECTS "
             + " Where SI_ID = " + checkID.ToString();
rptObj = infoStore.Query(query);
rpt = (Report) rptObj[1];
You also have to make sure that you've included CrystalDecisions.Desktop.Report in your References section and that you include "using CrystalDecisions.Desktop;" in in your code.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Oh, my apologies.. I neglected to mention that this is with XI R2. It works with CE10, XI R1, etc.

The only way I can get a handle on a report in XI R2 is by going:

Code:
InfoObjects ceInfoObjects = ceInfoStore.Query("Select * From CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Report' And SI_ID=" + reportID);

InfoObject ceInfoObject = ceReportObjects[1];

Report ceReport = new Report(ceInfoObject.PluginInterface);

Either by design or a bug.. but I think the latter!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top