This is a migrated thread and some comments may be shown as answers.

Report works in Designer until I add a parameter, then "Exception thrown by target of invocation"

7 Answers 249 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
WombatEd
Top achievements
Rank 1
WombatEd asked on 10 Jan 2011, 05:53 AM
My report was working fine using a SqlDataSource that used a SELECT without any WHERE clause.  Then I changed it to use an ObjectDataSource method that uses parameters to generate a WHERE clause, and my report now fails.  The ObjectDataSource method works fine when invoked by my WebForms, and I tried putting a breakpoint in my business object's Select method, and I never got there, so I'm pretty sure it's not a problem within my object.

When I try to "preview" the report, the designer shows me this error message:
    An error has occurred while processing Report 'MyReport':
    Exception has been thrown by the target of an invocation.
    --------------------- InnerException ----------------------
    Object reference not set to an instance of an object.

I based my implementation upon this tutorial: http://tv.telerik.com/watch/reporting/objectdatasource/using-parameters-with-objectdatasource-component

I'm a Reporting newbie, and I need to learn how to debug reports.  (Apparently you can't simply step through them using the debugger.)  So any tips on how to investigate report bugs would be gratefully accepted.

7 Answers, 1 is accepted

Sort by
0
WombatEd
Top achievements
Rank 1
answered on 10 Jan 2011, 06:08 PM
This problem only occurs if I use an ObjectDataSource.  If I use a SqlDataSource, with the same parameter, the report works.
0
WombatEd
Top achievements
Rank 1
answered on 10 Jan 2011, 06:37 PM
I've submitted this as a Support Ticket: #382736.
0
Daniel
Top achievements
Rank 1
answered on 04 Feb 2011, 09:14 AM
Have you got any valid solution?

Thanks
Daniel
0
Ayman
Top achievements
Rank 1
answered on 27 Feb 2011, 12:11 PM
Any solution ?!
0
WombatEd
Top achievements
Rank 1
answered on 27 Feb 2011, 04:33 PM
This problem was only appearing in the designer's preview modes.  When I added code to programmatically assign the ObjectDataSource, the problem went away.
0
Jo
Top achievements
Rank 1
answered on 27 Feb 2012, 10:35 PM
I am having a same problem which WombatEd posted at the beginning of this post, I am using ObjectDataSource with Sharepoimt List.
I am trying to create a report in telerik reporting and upload it in  sharepoint as a webpart.
I also refer the video suggested in above post and I am doing exactly the same, however, When I try to "preview" the report, the designer shows me this error message:

    An error has occurred while processing Report 'MyReport':
    Exception has been thrown by the target of an invocation.
    --------------------- InnerException ----------------------
    Object reference not set to an instance of an object. 

Can anyone give me the fix.. 
And also Is there a way to use more than one objectdatasource in a Report.

Thanks In advance..





0
Steve
Telerik team
answered on 01 Mar 2012, 06:40 PM
Hello Nu,

In the case of report designer/preview the current application is devenv.exe so reading the  ConfigurationManager.ConnectionStrings from the report that is previewed will get all connection strings defined in the devenv.exe.config file. SqlDataSource works, because we connect directly to the Sql server, while in the ObjectDataSource, you're using external custom methods that can't resolve the connectionstring for the devenv.exe runtime. 

In order to avoid this behavior you have several options:

  1. Hard code the connection string
  2. Simply use an actual application to view your reports in runtime instead of the Previews.
  3. Use SqlDataSource instead that will handle the connection strings

Regards,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
Tags
General Discussions
Asked by
WombatEd
Top achievements
Rank 1
Answers by
WombatEd
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Ayman
Top achievements
Rank 1
Jo
Top achievements
Rank 1
Steve
Telerik team
Share this question
or