|
when i deploy the application on a server and try to run it through my local machine the report is being created on server. Is there a way to generate the report on client machine?
|
|
|
|
|
how to add web reference to the web services exposed by Reporting Services 2005,..
I am new to rdl please help i want to render rdl report in pdf. I have deployed a report in remote server
harini
|
|
|
|
|
This is a great starting point for link ssrs with c#
|
|
|
|
|
I was having trouble finding out how to interface to a Report Server project until I came across this article. I used the code and had no trouble creating a report.
|
|
|
|
|
One or more data source credentials required to run the report have not been specified. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: One or more data source credentials required to run the report have not been specified.
My application gives me above error
How to solve it.
Actually i am able to give Network credential, but i don't know how to give Database credential to object.
Following is my code.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Configuration;
namespace MLAFMSPresentation
{
public class MyReportRenderer
{
private localhost.ReportingService2005 rs;
private rsExecution.ReportExecutionService rsExec;
public void renderTest(string filepath, string targetpath)
{
rs = new localhost.ReportingService2005();
rsExec = new rsExecution.ReportExecutionService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["NetworkUser"].ToString(), ConfigurationManager.AppSettings["NetworkPassword"].ToString(), ConfigurationManager.AppSettings["NetworkDomain"].ToString());
rs.Url = "http://192.168.0.22:8080/ReportServer_SQL2008/ReportService2005.asmx";
rsExec.Url = "http://192.168.0.22:8080/ReportServer_SQL2008/ReportExecution2005.asmx";
string historyID = null;
string deviceInfo = null;
string format = "PDF";
Byte[] results;
string encoding = String.Empty;
string mimeType = String.Empty;
string extension = String.Empty;
rsExecution.Warning[] warnings = null;
string[] streamIDs = null;
string fileName = targetpath;
string _reportName = filepath;
string _historyID = null;
bool _forRendering = false;
localhost.ParameterValue[] _values = null;
localhost.DataSourceCredentials[] _credentials = null;
localhost.ReportParameter[] _parameters = null;
try
{
_parameters = rs.GetReportParameters(_reportName, _historyID, _forRendering, _values, _credentials);
rsExecution.ExecutionInfo ei = rsExec.LoadReport(_reportName, historyID);
rsExecution.ParameterValue[] parameters = new rsExecution.ParameterValue[4];
parameters[0] = new rsExecution.ParameterValue();
parameters[0].Name = "pk_RequestId";
parameters[0].Label = "pk_RequestId";
parameters[0].Value = "9";
parameters[1] = new rsExecution.ParameterValue();
parameters[1].Name = "Userid";
parameters[1].Label = "Userid";
parameters[1].Value = "1";
parameters[2] = new rsExecution.ParameterValue();
parameters[2].Name = "fk_FinancialYearId";
parameters[2].Label = "fk_FinancialYearId";
parameters[2].Value = "1";
parameters[3] = new rsExecution.ParameterValue();
parameters[3].Name = "fk_Constituencyid";
parameters[3].Label = "fk_Constituencyid";
parameters[3].Value = "1";
rsExec.SetExecutionParameters(parameters, "en-us");
results = rsExec.Render(format, deviceInfo,
out extension, out encoding,
out mimeType, out warnings, out streamIDs);
using (FileStream stream = File.OpenWrite(fileName))
{
stream.Write(results, 0, results.Length);
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
|
|
|
|
|
Did you figure it out?
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
I understand the C# code written here.
I use Stored Procedures all the time in SQLServer 2005.
However, I have never deployed C# code.
Can someone give me some hints on taking what Sivakumar has given us and getting it implemented on our SQLServer 2005?
I plan to add it or integrate it with an e-mailing stored procedure I have.
|
|
|
|
|
"Step 2: Add a web reference to the web services exposed by Reporting Services 2005, i.e., ReportExecution2005 and ReportService2005."
Can you give any example of url to the reporting service. I've published a report and can browse it i IE7 with this url: http://n29769:8080/Reports/Pages/Report.aspx?ItemPath=%2fReport+Project1%2fUsers[^]
but get "The URI prefix is not recognized" when try to add a Web Reference in VS2008
_____________________________
...and justice for all
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace ReportServerProject
{
class MyReportRenderer
{
private rs2005.ReportingService2005 rs;
private rs2005Execution.ReportExecutionService rsExec;
public void renderTest()
{
rs = new rs2005.ReportingService2005();
rsExec = new rs2005Execution.ReportExecutionService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = "http://<servername>/ReportServer/ReportService2005.asmx";
rsExec.Url = "http://<servername>/ReportServer/ReportExecution2005.asmx";
string historyID = null;
string deviceInfo = null;
string format = "PDF";
Byte[] results;
string encoding = String.Empty;
string mimeType = String.Empty;
string extension = String.Empty;
rs2005Execution.Warning[] warnings = null;
string[] streamIDs = null;
string fileName = @"c:\samplereport.pdf";
string _reportName = @"/My Reports/<reportname>";
string _historyID = null;
bool _forRendering = false;
rs2005.ParameterValue[] _values = null;
rs2005.DataSourceCredentials[] _credentials = null;
rs2005.ReportParameter[] _parameters = null;
try
{
_parameters = rs.GetReportParameters(_reportName, _historyID, _forRendering, _values, _credentials);
rs2005Execution.ExecutionInfo ei = rsExec.LoadReport(_reportName, historyID);
rs2005Execution.ParameterValue[] parameters = new rs2005Execution.ParameterValue[1];
if (_parameters.Length > 0)
{
parameters[0] = new rs2005Execution.ParameterValue();
parameters[0].Label = "<replace with="" parameter="" label="">";
parameters[0].Name = "<replace with="" parameter="" name="">";
parameters[0].Value = "<replace with="" parameter="" value="">";
}
rsExec.SetExecutionParameters(parameters, "en-us");
results = rsExec.Render(format, deviceInfo,
out extension, out encoding,
out mimeType, out warnings, out streamIDs);
using (FileStream stream = File.OpenWrite(fileName))
{
stream.Write(results, 0, results.Length);
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
</replace></replace></replace></reportname></servername></servername>
|
|
|
|
|
actually this is even easier. You have far too much code and this guy made things confusing without saying where to grab info
<br />
string deviceInfo = null;<br />
string extension = String.Empty;<br />
string mimeType = String.Empty;<br />
string encoding = String.Empty;<br />
Warning[] warnings = null;<br />
string[] streamIDs = null;<br />
string historyId = null;<br />
<br />
ReportExecutionService rsExec = new ReportExecutionService();<br />
rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;<br />
rsExec.Url = ConfigurationManager.AppSettings["ReportServer"] + "/ReportExecution2005.asmx";<br />
rsExec.LoadReport("/ReportMainFolder/ReportName", historyId);<br />
<br />
rsExec.SetExecutionParameters(<br />
new ParameterValue[]<br />
{new ParameterValue() {Name = "ParamEvent", Value = "MyValue"}},null);<br />
<br />
Byte[] results = rsExec.Render("PDF", deviceInfo,<br />
out extension, out encoding,<br />
out mimeType, out warnings, out streamIDs);<br />
<br />
Walla...almost no code, it's easy to manage and your done.
Take the bytes and add as an attachment to mail:
<br />
mailMessage.Attachments.Add(new Attachment(new MemoryStream(attachment),String.Format("{0}_DocumentSavingsReport.pdf", "ReportName") ));<br />
or
<br />
Response.Write(result);<br />
It's just that easy folks!
l8rs
Nick
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
Hi
I have created the PDF file successfully. but i need to protect my pdf file by using the password.. Is is possible ?.. if any one know kindly help me..
Thanks and Regards
Selvaraj
|
|
|
|
|
Hi,
I protected the pdf using ISharpText Liabrary, its open source liabray.
check the below code.
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Dim password As String = "yourPassword"
Dim outputFile As String = "c:\myPasswordPdf.pdf"
Dim reader As PdfReader = New PdfReader("PathForPdf")
PdfEncryptor.Encrypt(reader, New IO.FileStream(outputFile, FileMode.Create), True, password, password, PdfWriter.ALLOW_PRINTING)
|
|
|
|
|
I have a couple of reports about 30 pages long mixed with graphs, matrixes and tables.
I access these reports using an url. When rendering to html it takes about 30 seconds, and when rendering to pdf it takes about 90 seconds. These reports has been converted from crystal reports, crystal manages to render the same report to pdf in 30 seconds.
Is there anything I can do to improve rendering performance (to pdf)?
regards
Richard
|
|
|
|
|
Sorry I looked at this and it didn't work and looks like rubbish, I have made a far simpler version here:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ReportExecutionServiceReference;
namespace Reporting
{
public class ReportPDFTools
{
public byte[] RenderPDFReport( string url, string reportPath, ReportParameter[] parameters )
{
ReportExecutionService rs = new ReportExecutionService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
string format = "PDF";
string historyID = null;
string encoding;
string mimeType;
string extension;
Warning[] warnings = null;
string[] streamIDs = null;
ExecutionInfo execInfo = new ExecutionInfo();
ExecutionHeader execHeader = new ExecutionHeader();
execInfo = rs.LoadReport(reportPath, historyID);
rs.SetExecutionParameters(
parameters.Select(
p => new ParameterValue
{ Label = p.Name,
Name = p.Name,
Value = p.Value }
).ToArray(), "en-us");
rs.ExecutionHeaderValue = execHeader;
rs.ExecutionHeaderValue.ExecutionID = execInfo.ExecutionID;
return rs.Render(format, null, out extension, out encoding, out mimeType, out warnings, out streamIDs);
}
}
public struct ReportParameter {
public string Name;
public string Value;
}
}
You can then drive this from a simple console application method, this is what I did:
///
/// -p, --renderpdf-report <reportserviceurl> <reportpath> <outputfile> <param />[..]
///
/// <param name="args" />
private static void RenderPDFReport(string[] args)
{
if (args.Contains("-p") || args.Contains("--renderpdf-report"))
{
if( args.Where( s => !s.Contains("=") ).Count() != 4 )
throw new ArgumentException( "Expected 4 non-param arguments, failing." );
Console.WriteLine("Rendering PDF Report...");
ReportPDFTools pdfTools = new ReportPDFTools();
ReportParameter[] _params =
args.Where(
s => s.Contains("=") )
.Select(
s => new ReportParameter{
Name=s.Split('=')[0],
Value=s.Split('=')[1] }
).ToArray();
File.WriteAllBytes(args[3],
pdfTools.RenderPDFReport(args[1], args[2], _params)
);
}
}
Regards
Tim Scarfe (www.developer-x.com)
|
|
|
|
|
We are losing all our nice white space formatting here!
I uploaded the bits to http://www.developer-x.com/dropbox/ReportingServices/RenderPDFReport.txt
Have fun
Tim Scarfe
|
|
|
|
|
|
i have also the problem when exporting to pdf, i get blank pages in the middle of the report.
i have a report that generates data grouped by territory, and each group has a different size.
so if u try to put 10 lines of data by page, it can't work, i get blank pages anyway.
|
|
|
|
|
Hi,
I have Deployed reports in my Report Server.
All the reports are working fine,
Then i send mail from particular user,
so try to create a new subscription,
but error thrown...
"The current action cannot be completed because the user data source credentials that are required to execute this report are not stored in the report server database. (rsInvalidDataSourceCredentialSetting) Get Online Help"
in my project folder am used two rdl files
example for (Report1.rdl, Report2.rdl)
& two Data Source (Remote1.rds, Remote2.rds)
Report1.rdl file is point to one Remote Machine using Remote1.rds datasource, Report2.rdl file is point to another Remote Machine using Remote2.rds datasource
its properly running in my ReportServer area
but create new subscription area thrown an error..
anybody give idea for that issue..
thanks for advance
regards,
Ram...
|
|
|
|
|
Can any body explain why I am getting blank pages when I export the report in pdf format?
Thank you.
vedd
|
|
|
|
|
I have a report which contains so many components.Some of these components are having the Visibility conditions.The Problem is that I am getting large white spaces between components while exporting the report to PDF.How can I avoid getting these spaces in PDF?
|
|
|
|
|
I have the same problem. Really annoying.
Some spaces i could avoid because there were overlapping items. but now there are no overlapping items. argh...
I'm using a list in a list. Both lists contain some textboxes. thats all.
Please help
|
|
|
|
|
I have managed to sort out the code above and get the application compiling and executing. However there seems to be a problem with the parameter that I define and and set with the SetExecutionParameters() method.
Everytime I try to run my report the following error is displayed
This report requires a default or user-defined value for the report
parameter 'contractid'. To run or subscribe to this report, you must provide a parameter value.
I am setting this parameter as follows:
parameters[0] = new ParameterValue();
parameters[0].Name = "contractid";
parameters[0].Value = "1";
rs.SetExecutionParameters(parameters, "en-us");
where rs is an ExecutionService.
If anyone knows what I am doing wrong or what I need to change on my report to get this working I'd like to hear from you.
mtembene
|
|
|
|
|
OK I figured it out after a bit of hacking.
In the end I discovered that though the parameter I had to set was a string the report writer and a set of predefined valid parameter values that had to be met. That was my first problem.
When running the report manually I could pick the parameter I wanted from a drop down list. The drop downlist actually provided a Guid as a parameter to the report.
So in the end I had to create a Guid in my code. Assign it a valid value and then add that value as a string to the parameter for my report.
Obvious in the end.
|
|
|
|
|
Hi - I have exactly the same problem with drop-down choices in a report, but dont quite understand what you mean
when you mention the use of a GUID. Do you mean that each option in the dropdown has an associated GUID that is the real value of the parameter - if so how do you get these values. Hope to hear from you soon.
Scott Hayles (scott.hayles@ntsolutions.com.au)
|
|
|
|
|
Hi All, I am having trouble getting this running - does anybody have a sample of this in a VS solution that I could have a look at please?
Sorry for being dense... All help greatfully received...
:-/
|
|
|
|