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

Designer use when code references external dlls

4 Answers 318 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeff Berry
Top achievements
Rank 2
Jeff Berry asked on 04 Jan 2010, 09:57 PM
I cannot get the Designer to work anytime I have report logic that references an external DLL.  This includes using the Enterprise Library DLLs for data access and also using user-defined functions that reference external dlls for formatting.

Here's a sample _NeedDataSource event.  It works fine at run time in the viewer, but the designer does not work at all.  (just like with external format functions I reference). 

 

 

private void rptCaseLoad_NeedDataSource( object sender, EventArgs e )   
{  
    DataSet ds = new DataSet( );   
    Database db = DatabaseFactory.CreateDatabase( );   
    using ( DbCommand cmd = db.GetStoredProcCommand( "spCaseDetail" ) )   
    {  
        cmd.CommandType = CommandType.StoredProcedure;   
        db.AddInParameter( cmd, "@caseID", DbType.Int32, iCaseID );   
        ds = db.ExecuteDataSet( cmd );   
    }  
    ( sender as Telerik.Reporting.Processing.Report ).DataSource = ds;   
   
}  
 
 
 

 


Any suggestions?

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 05 Jan 2010, 12:37 PM
Hi Jeff,

Please define what you mean by not working. If you expect that you would have your business objects available in the Data Explorer, then you are wrong, as you should have a datasource set in the designer for that.
If you simply cannot use the Previews in design time, then have in mind that the Telerik Report Designer operates inside the Visual Studio application. When previewing a report, the project that contains the report is compiled (if needed) and the report class is instantiated through Reflection, and passed to the previewer. This means that the report constructor is executed in the context of the Visual Studio application, so the current application is devenv.exe. Have in mind that the valid config file in this case is the devenv.exe.config file and any connectionStrings or references to your DAL should be added in that config when previewing and external assemblies present in the same folder.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jeff Berry
Top achievements
Rank 2
answered on 05 Jan 2010, 02:41 PM
Hi Steve,

I'm talking about the Preview tab. 

Concerning Enterprise Library, specifically, I get:

An error has occured while processing Report":
Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version 3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.  The system cannot find the file specified.


0
Jeff Berry
Top achievements
Rank 2
answered on 05 Jan 2010, 04:57 PM
Steve,

Your reply helped me get on the right track.  Thank you.  I had to 
  1. Add the connectionstring settings to devenve.exe.config (for enterprise library, there are a few that need added)
  2. Copy the Enterprise library dll's into the same directory as devenv.exe (this was causing my error)
  3. Copy the other external dll I was referencing to devenv.exe directory also

I hope this helps someone else because this has been a pain for me for awhile now.

Thanks,
Jeff

0
Joanna LaForte
Top achievements
Rank 1
answered on 06 Aug 2010, 09:23 PM
Very helpful.  Thanks so much for posting your solution!  It fixed an issue I'd been struggling with today just when I needed it fixed.  :)
Tags
General Discussions
Asked by
Jeff Berry
Top achievements
Rank 2
Answers by
Steve
Telerik team
Jeff Berry
Top achievements
Rank 2
Joanna LaForte
Top achievements
Rank 1
Share this question
or