Advertisement
Guest User

LinqDataSource does not work with Microsoft.Reporting.LocalReport

a guest
Feb 27th, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. //Creating report
  2. Microsoft.Reporting.WebForms.LocalReport report = new Microsoft.Reporting.WebForms.LocalReport();
  3. report.ReportPath = Request.PhysicalApplicationPath + @"pathToreport.rdlc";
  4. report.DisplayName = "Ttile";
  5.  
  6. //Setting the data
  7. //SetMyLinqDataSource();
  8. myLinqDataSource.WhereParameters.Add(new Parameter("bla", avalue));
  9. myLinqDataSource.Where = "field1 = @bla";
  10. report.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("MyDataSetName", myLinqDataSource));
  11.  
  12. //delivering to web user
  13. Microsoft.Reporting.WebForms.Warning[] warnings;
  14. string[] streamids;
  15. string mimeType;
  16. string encoding;
  17. string extension;
  18. //Here the databind should happen
  19. byte[] bytes = report.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
  20.  
  21. Response.Clear();
  22. Response.ContentType = "application/pdf";
  23. Response.AddHeader("content-disposition", "attachment; filename=Report.pdf");
  24. Response.Flush();
  25. Response.BinaryWrite(bytes);
  26. Response.Flush();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement