Friday, February 24, 2012

"Invalid object format name" Error

Hi there,

I am trying to upgrade a crystal application from VS.Net 2003 to VS.Net 2005. Some of the reports work just fine in the new enviroment. But one of the reports does give me a hard time.

It is a little complicated, so please bare with me. The report uses a c# derived DataSet class as its Database Fields source. It also uses a DataTable as its data source. When I try to bind the report with the data source, for example, myReport.setDataSource(myDataTable);. It throws the following exception:

CrystalDecisions.CrystalReports.Engine.InternalException was unhandled by user code
Message="\rError in File C:\\WINDOWS\\TEMP\\temp_c2eb4661-c3c0-429a-9d9f-c0b280e112bc {645E2563-B9C6-4A6F-9714-618DF7CB1EE2}.rpt:\nInvalid object format name."
Source="CrystalDecisions.ReportAppServer.DataSetConversion"
StackTrace:
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)
at NL2.Web.GlRptFsWModule.getReport(Boolean sendToPrinter, exportTo eExport) in c:\Inetpub\wwwroot\NL2\Web\reports\GlRptFsWModule.ascx.cs:line 900
at NL2.Web.GlRptFsWModule.cViewButton_Click(Object sender, EventArgs e) in c:\Inetpub\wwwroot\NL2\Web\reports\GlRptFsWModule.ascx.cs:line 1246
at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)
at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I traced the program and realized that once I change the format of the FieldObject and call the report object's refresh() method, the same exception is thrown. For example:

myReport.Refresh(); // ok here
myFiledObject.Width = 0;
myReport.Refresh(); // throw exception

I also tried to reset all the FieldFormat for the FieldObject, but the same thing happen. Once I change the FieldFormat and refresh, it throws an exception. I am so confused now!

myReport.Refresh(); // ok here
myFiledObject.FieldFormat.BooleanFormat.OutputType = BooleanOutputType.TrueOrFalse;
myReport.Refresh(); // throw exception

Can any crystal report expert/genius give me some hints on what did I do wrong or what could be the problem? Thanks in Advance!If possible, use verify database option and check whether it is connected to the server properly

No comments:

Post a Comment