Reputation: 12517
I store rdl's remotely in a sql server database in binary format. I would like to use the report viewer control to display the report.
This seems like a simple concept but I keep finding conflicting tutorials which have several different approaches...none of which I can get to work.
Am I right in thinking that all I need is the report viewer control to get this working? If so, how is it possible to open a remotely stored .rdl file?
I also have a variable which has the rdl content stored in a string...not sure if this helps? So either I can use this string or pull the .rdl from the db...
I am a newbie to .NET so I am not sure how to best approach this...So far I have the following:
ReportViewer r = new ReportViewer();
//pass the rdl to report viewer
r.ProcessingMode = ProcessingMode.Remote;
Upvotes: 2
Views: 5008
Reputation: 1
Try to revise this code:
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerNetworkCredentials();
//ReportViewer1.ServerReport.ReportServerCredentials = new Rep();
ReportViewer1.ServerReport.ReportServerUrl = new Uri(@"http://PRODUCTIONDB:80/ReportServer/MexReports"); //report server
ReportViewer1.ServerReport.ReportPath = "rptMEXHEDailyReportReview1"; // rdl name
Upvotes: 0
Reputation: 4092
You need to actually set it to Local processing mode not remote.
I've only ever loaded a RDL from a DLL not a database but I would look at the following API as it might have an overload to accept a string or you convert your string to a stream.
reportViewer.LocalReport.LoadReportDifinition
Here is the code I use to load from a DLL (might help to see in context)
Assembly assembly = Assembly.LoadFrom("MyReports.dll");
Stream stream = assembly.GetManifestResourceStream("Reports.MyReport.rdlc");
reportViewer.LocalReport.LoadReportDifinition(stream);
Upvotes: 3