May 5, 2009 at 1:32 am
Hi,
I trying to generate pdf file by using the report from Reporting. I found the C# code as follow but I see that the 2005/2008 websvc doesn't have the SessionHeader class as seen in SQL 2000.
I think, this code is for SQL 2000 and what I
am I to do in 2008?
Anyone give me some sample code please.
Thank you..
ReportingService.ReportingService rs = new ReportingService.ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Render arguments
byte[] result = null;
string format = "PDF";
string historyID = null;
string devInfo = null;
parameters = new ReportingService.ParameterValue[1];
parameters[0] = new ReportingService.ParameterValue();
parameters[0].Name = "SelectedTable";
parameters[0].Value = selectedTable;
ReportingService.DataSourceCredentials[] credentials = null;
string showHideToggle = null;
string encoding;
string mimeType;
ReportingService.Warning[] warnings = null;
ReportingService.ParameterValue[] reportHistoryParameters = null;
string[] streamIDs = null;
ReportingService.SessionHeader sh = new ReportingService.SessionHeader();
rs.SessionHeaderValue = sh;
try
{
result = rs.Render(reportPath, format, historyID, devInfo, parameters, credentials,
showHideToggle, out encoding, out mimeType, out reportHistoryParameters, out warnings,
out streamIDs);
string filename = "";
FileStream stream = File.Create(filename, result.Length);
stream.Write(result, 0, result.Length);
stream.Close();
System.Diagnostics.Process.Start(filename);
}
catch (System.Web.Services.Protocols.SoapException e)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
June 23, 2011 at 6:57 am
Hi there
you are probably using sql server 2008 and in that version they removed the SessionHeader class you should use the ReportExecutionService class of 2008
here is the link that can help you get started :
http://msdn.microsoft.com/en-us/library/reportexecution2005.reportexecutionservice.render.aspx
🙂
July 3, 2018 at 7:56 am
I have used ZetPDF.com which is a good platform that generate pdf files on C#.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply