using Oranikle.Report.Engine; // Initialize the report engine Oranikle.Report.Engine.ReportEngine re = new Oranikle.Report.Engine.ReportEngine(); // Load the report file re.LoadReport("example.rdl"); // Set the report parameters re.ReportParameters["StartDate"].Value = new DateTime(2022, 1, 1); re.ReportParameters["EndDate"].Value = new DateTime(2022, 12, 31); // Generate the report re.RenderToPdf("example.pdf");
using Oranikle.Report.Engine; using System.Data.SqlClient; // Initialize the report engine Oranikle.Report.Engine.ReportEngine re = new Oranikle.Report.Engine.ReportEngine(); // Load the report file re.LoadReport("example.rdl"); // Connect to SQL server SqlConnection conn = new SqlConnection("Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"); conn.Open(); // Execute SQL query SqlCommand cmd = new SqlCommand("SELECT * FROM Customers", conn); SqlDataReader reader = cmd.ExecuteReader(); // Populate the report with data re.PopulateData(reader); // Generate the report re.RenderToPdf("example.pdf"); // Close the SQL connection conn.Close();This example shows how to populate a report template with data from a SQL database using the Oranikle.Report.Engine. The report file contains data regions that are linked to SQL queries using the DataSetName property. The SQL query is executed using the SqlConnection, SqlCommand, and SqlDataReader classes. The report is then populated with data using the PopulateData method and rendered to a PDF file using the RenderToPdf method. Overall, the Oranikle.Report.Engine is a powerful library for generating reports in C# using SQL data sources. It supports a wide range of report formats, including PDF, HTML, Excel, and Word, and provides extensive customization options for report templates.