Saturday, March 31, 2012

System.InvalidCastException: Specified cast is not

The system worked well until the personnel of the support installed Crystal
Reports Framework 2.0 starting from this moment started to give the mistake below.
Does anybody know how to explain to me the why is happening this mistake?

Server Error in '/SISTEMA' Application.
Specified cast is not valid.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Specified cast is not valid.

Source Error:
Line 240: //{Line 241: ceReportObject = objReports[1];

Line 242: ceReport = (Report)ceReportObject;

Line 243: ceParameters = ceReport.ReportParameters;Line 244:

Source File:
d:\projetos\sistema\wwwroot\formrelatoriosreservasspever1.aspx.cs
Line: 242

Stack Trace:
[InvalidCastException: Specified cast is not valid.]
sistema.FormRelatoriosReservasSPEVer1.PassarParametros(String
strParam, String strTipoParam, String strNomeParam) in
d:\projetos\sistema\wwwroot\formrelatoriosreservasspever1.aspx.cs:242
sistema.FormRelatoriosReservasSPEVer1.VerRelatorio() in
d:\projetos\sistema\wwwroot\formrelatoriosreservasspever1.aspx.cs:503
sistema.FormRelatoriosReservasSPEVer1.InicializaCrystal() in
d:\projetos\sistema\wwwroot\formrelatoriosreservasspever1.aspx.cs:583
sistema.FormRelatoriosReservasSPEVer1.InitializeComponent() in
d:\projetos\sistema\wwwroot\formrelatoriosreservasspever1.aspx.cs:628
sistema.FormRelatoriosReservasSPEVer1.OnInit(EventArgs e) in
d:\projetos\sistema\wwwroot\formrelatoriosreservasspever1.aspx.cs:619
System.Web.UI.Control.InitRecursive(Control namingContainer)
System.Web.UI.Page.ProcessRequestMain()

Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET Version:1.1.4322.2032

Description
Crystal Enterprise 10, Crystal Reports 10 e VS.Net 2003

Thanks

Set a break point on that line and debug. What type of object is objReports[1], as displayed in the Watch window? and what type of object is ceReportObject, which you are trying to assign it to?

0 comments:

Post a Comment