Exception of type System.Exception was thrown.

  • Thread starter Thread starter Selen
  • Start date Start date
S

Selen

I am using asp.net c#...I am adding a field to cystal report but I get error
Exception of
type System.Exception was thrown. How can I solve this error...When I insert
a field from another table I dont get error...

Thanks...
 
Selen said:
I am using asp.net c#...I am adding a field to cystal report but I get error
Exception of
type System.Exception was thrown. How can I solve this error...When I insert
a field from another table I dont get error...

Whenever you get an exception, you should look at the message inside it
- it will almost always tell you what went wrong.
 
How can I look inside it...I am using try catch like that: but I didnt catch
anything...

try

{

ParameterFields paramFields=new ParameterFields ();

ParameterField paramField=new ParameterField ();

ParameterDiscreteValue discreteVal=new ParameterDiscreteValue ();


paramField.ParameterFieldName="Tip";

discreteVal.Value =Session["Tip"].ToString ();

paramField.CurrentValues.Add (discreteVal);

paramFields.Add (paramField);

this.CrystalReportViewer2 .ParameterFieldInfo =paramFields;






CrystalDecisions.Shared.TableLogOnInfo myLogin=new TableLogOnInfo ();


report.Load (Server.MapPath ("Status.rpt"));

foreach(CrystalDecisions.CrystalReports.Engine.Table mytable in
report.Database .Tables )

{

myLogin=mytable.LogOnInfo ;

myLogin.ConnectionInfo .Password ="abc";

myLogin.ConnectionInfo .UserID ="sa";

mytable.ApplyLogOnInfo (myLogin);

}



this.CrystalReportViewer2 .ReportSource =report;

}

catch(Exception ex)

{


}
 
Selen said:
How can I look inside it...I am using try catch like that: but I didnt catch
anything...

Ah... if you're unable to catch the exception, that certainly makes
things harder.

You could try using the AppDomain.UnhandledException to see whether you
can see the exception that way...
 
Selen said:
I dont know using it...
How can I use it??

The same way you use any event - you subscribe to it, providing a
delegate which will be called when the event fires (in other words,
when an exception is thrown).

You probably then want to log the details of the exception.
 
Given that your catch handler is catching all managed exceptions
(System.Exception), then either you did catch it but didn't do anything with
it, or the exception is thrown from some other part of your code.

Try adding a trace statement inside the catch block and see what it prints
out.



Selen said:
How can I look inside it...I am using try catch like that: but I didnt catch
anything...

try

{

ParameterFields paramFields=new ParameterFields ();

ParameterField paramField=new ParameterField ();

ParameterDiscreteValue discreteVal=new ParameterDiscreteValue ();


paramField.ParameterFieldName="Tip";

discreteVal.Value =Session["Tip"].ToString ();

paramField.CurrentValues.Add (discreteVal);

paramFields.Add (paramField);

this.CrystalReportViewer2 .ParameterFieldInfo =paramFields;






CrystalDecisions.Shared.TableLogOnInfo myLogin=new TableLogOnInfo ();


report.Load (Server.MapPath ("Status.rpt"));

foreach(CrystalDecisions.CrystalReports.Engine.Table mytable in
report.Database .Tables )

{

myLogin=mytable.LogOnInfo ;

myLogin.ConnectionInfo .Password ="abc";

myLogin.ConnectionInfo .UserID ="sa";

mytable.ApplyLogOnInfo (myLogin);

}



this.CrystalReportViewer2 .ReportSource =report;

}

catch(Exception ex)

{


}
 
Back
Top