I've create a SAP crystal report to be based on ASP.NET and this table was build out by command table. I need to setting and getting the command query of report at run time, but it just happened to gave me error as "Unable to cast COM object of type 'System.__ComObject' to interface type 'CrystalDecisions.ReportAppServer.DataDefModel.CommandTable'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{EC2F9A25-E94D-40C0-BF21-3C9D748CC983}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))".
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptinnerfile = rptfile.ReportClientDocument; CrystalDecisions.ReportAppServer.Controllers.DataDefController rptdatadefcontroller = rptinnerfile.DataDefController; CrystalDecisions.ReportAppServer.DataDefModel.Database rptinnerdatabase = rptdatadefcontroller.Database; CrystalDecisions.ReportAppServer.DataDefModel.CommandTable rptcmdtable = new CrystalDecisions.ReportAppServer.DataDefModel.CommandTable(); foreach(CrystalDecisions.ReportAppServer.DataDefModel.Table tbl in rptinnerdatabase.Tables) { rptcmdtable = (CrystalDecisions.ReportAppServer.DataDefModel.CommandTable) tbl; }
I've been struggling for this problem in few days, i'm hoping someone could help me out on this problem.Thanks