Catching missing fields exception

Stimulsoft Reports.NET discussion
Post Reply
patwolf
Posts: 90
Joined: Thu May 29, 2008 1:38 pm
Location: Los Angles

Catching missing fields exception

Post by patwolf »

We use one report on multiple related but not the same datasets.
Now I would like to show the user the names of the fields which are referenced in the report but are missing in the current dataset in a nice error message.

So I got this code to view a report.
try
{
DataSet ds = GetDs();
var report = new StiReport();
report.Load(fpn);
report.Render(false);
}
catch (Exception ex)
{
When a field is missing I get this error:
c:\Users\..\AppData\Local\Temp\a3zl2axx.0.cs(75,33) : error CS1061: 'Reports.Report.humanuserDataSource' does not contain a definition for 'sg_department' and no extension method 'sg_department' accepting a first argument of type 'Reports.Report.humanuserDataSource' could be found (are you missing a using directive or an assembly reference?)c:\Users\..\AppData\Local\Temp\a3zl2axx.0.cs(80,50) : error CS1061: 'Reports.Report.humanuserDataSource' does not contain a definition for 'sg_department' and no extension method 'sg_department' accepting a first argument of type 'Reports.Report.humanuserDataSource' could be found (are you missing a using directive or an assembly reference?)

Is there a better Exception I could catch to get just the missing field name(s) please?

Thanks
Patrick
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Catching missing fields exception

Post by HighAley »

Hello.

Unfortunately, there is no other exception.
You could parse the error message to get the missing field.

Thank you.
Post Reply