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

RenderReport not retrieving data from database

1 Answer 64 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 15 May 2014, 11:32 PM
I have a Telerik Report to produce monthly invoices. When I run the invoices into a Telerik Report Viewer, it works great.

If I use the same Report with RenderReport to run the invoices into a PDF document to
be emailed, the PDF consists of the report's header logo, and the footer
datetime and page number. The center section (retrieved from the
database) is blank. I'm not sure what I'm doing wrong. I've verified
that the parameters passed are correct and the same as the ones passed
into the Report Viewer. Any help would be appreciated.


private string SendOutInvoiceEmails(DateTime dtStartDate, Int16 intFinalInvoice, Int16 intFacility)
{
var typeReportSource = new Telerik.Reporting.TypeReportSource();
typeReportSource.TypeName = "TelerikReports.InvoiceMaster, TelerikReports";
typeReportSource.Parameters.Add("RID", rdr["Resid"]);
typeReportSource.Parameters.Add("RDM", dtStartDate.Month);
typeReportSource.Parameters.Add("RDY", dtStartDate.Year);

MailReport(typeReportSource, "admin@rexxrally.com", recRes.email_address, "Monthly Invoice For " + dtStartDate.ToString("MMM") + ", " + dtStartDate.ToString("yyyy"), "Here is your monthly invoice.", rdr["resid"].ToString());
}


void MailReport(Telerik.Reporting.ReportSource rptSource,
string from,
string to,
string subject,
string body,
string ResID)
{
ReportProcessor reportProcessor = new ReportProcessor();
RenderingResult result = reportProcessor.RenderReport("PDF", rptSource, null);
MemoryStream ms = new MemoryStream(result.DocumentBytes);
ms.Position = 0;
Attachment attachment = new Attachment(ms, "Invoice" + ResID + ".pdf");

MailMessage msg = new MailMessage(from, to, subject, body);
msg.Attachments.Add(attachment);

SmtpClient smptClient = new SmtpClient();
smptClient.Credentials = CredentialCache.DefaultNetworkCredentials;

smptClient.Send(msg);
}

1 Answer, 1 is accepted

Sort by
0
Dave
Top achievements
Rank 1
answered on 15 May 2014, 11:56 PM
Never mind. I figured out my problem. It was a coding issue, not related to Telerik at all.
Tags
General Discussions
Asked by
Dave
Top achievements
Rank 1
Answers by
Dave
Top achievements
Rank 1
Share this question
or