Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Telerik Reporting, EntityDatasource, Runtime setting of DbContext

$
0
0

hi,

we're struggled quite a lot with building telerik reports using the new Q1 2015 report builder and are hopefully at the final hurdle.

We've built a report using an entitydatasource pointed at a function written in the DbContext project, GetOrderById(int id). This produces an invoice output which now works in the designer.

When we run it in our application using the webforms report viewer (for compatability purposes) it keeps trying to create a local database instead of reading the sql server connection of the context we've passed in to it.

 

Here is the runtime code that i've bound to the page_load event of a page (for getting it working purposes)

Dimsource = NewTelerik.Reporting.UriReportSource()
        source.Uri = "web/apps/shared/InvoiceReport2.trdx"
 
 
        Dimreport = NewTelerik.Reporting.Report
 
        Dimds AsNewEntityDataSource()
        Dimcontext = NewDataContext(connectionString) // passed in as a text string and is 100% valid
 
        ds.Context = context
        ds.ContextMember = "GetOrderForReports"
        ds.Parameters.Add("OrderId", GetType(Integer), 89720)
 
        report.DataSource = ds
        ReportViewer1.ReportSource = source
        ReportViewer1.RefreshReport()

the error we get is as below. any help would be great, cheers.

An error has occurred while processing Report 'invoicereport2': An error occurred while invoking data retrieval method. ------------- InnerException ------------- Exception has been thrown by the target of an invocation. ------------- InnerException ------------- Directory lookup for the file "D:\xxxxxx\WebSites\xxxxx\App_Data\xxxxx.mdf" failed with the operating system error 2(The system cannot find the file specified.). CREATE DATABASE failed. Some file names listed could not be created. Check related errors. 

Viewing all articles
Browse latest Browse all 94857

Trending Articles