GST Billing Software

header image

ADVANCED CONCEPTS

Erachana Line

1.1 PASSING A DATA TABLE TO REPORT

Pass DataTable from .NET to Report

In this example a rdl viewer is created and then we assign a .net DataTable as the data for the reports DataSet "DataSetNameInYourReport".

using fyiReporting.RDL;
using fyiReporting.RdlViewer;
using fyiReporting.Data;
fyiReporting.RdlViewer.RdlViewer rdlView = new fyiReporting.RdlViewer.RdlViewer();
rdlView.SourceFile = new Uri("\\path\to\your\report.rdl");
rdlView.Parameters += string.Format("&parameter_name={0}", "What ever you want to pass in");
// This table needs to match the one you are setting
rdlView.Report.DataSets["DataSetNameInYourReport"].SetData(YourDataTable);  
rdlView.Rebuild();


1.2 CHANGE SQL STRING FROM CODE

In this example a rdl viewer is created and then we assign a new sql string to the dataset for the reports DataSet "DataSetNameInYourReport".

Column name and data types must match the report definition.

using fyiReporting.RDL;
using fyiReporting.RdlViewer;
using fyiReporting.Data;
fyiReporting.RdlViewer.RdlViewer rdlView = new fyiReporting.RdlViewer.RdlViewer();
rdlView.SourceFile = new Uri("\\path\to\your\report.rdl");
// Column name and data types must match the report definition.
rdlView.Report.DataSets["DataSetNameInYourReport"].SetSource("SELECT CategoryID, 
CategoryName, Description FROM Categories where CategoryName = 'SeaFood'");
rdlView.Rebuild();

1.3 PASS AN IMAGE TO THE REPORT

In this example an image is passed to a report to be displayed. You must convert any image you want to pass in to the report into a base64 string. Then once passed to the report as a string parameter your report will convert it back into an image.

In the report you need an image. Once the image is on the report right click it and select properties. In the Image tab in the source groupbox make sure the Database radio button is selected and the combobox is image/jpeg. In the function line below make sure you have =Convert.FromBase64String(Parameters!image_parameter_name.Value) image field on the report.


1.4 ASSIGNMENTS

  • Using the reporting tool, create reports for various forms in contact manager application.
  • Explain briefly about the steps that are followed to change SQL string from the desired code.
  • How to export the report to excel?