Monday, May 23, 2011

Connecting ActiveReports to alternate DataSources


We can connect ActiveReports to any datasource that a .NET object can connect to. The fact that has to be taken care of during this is that we provide a valid connection string and a valid sql statement to the reports designed so. The following link has a list of connection strings

http://connectionstrings.com/

Once a valid connection string and sql statement has been provided to ActiveReports, the list of field values would be populated which you can now drag inside the report and create a report design and run the same.

For the sake of illustration,please refer to the sample application at this link. It contains two reports,one connecting to an Excel file and the other connecting to a comma delimited text file in the DataSource folder at the root of the project.Both the reports use the Microsoft.Jet.Oledb provider to connect to the respective files.

An important point worth mentioning is that on connection to an Excel file ,the SQL to be written should be of something in this format.

Select * from [Sheet1$]

Here Sheet1 happens to be the name of the Sheet in the Excel File that contains the data to be consumed by the report and it has to follow by a dollar($) sign.

ActiveReports


ActiveReports is one of the most popular reporting tools in the software industry meant to design reports both for windows and web environments.It is written in managed C# and allows Visual Studio programmers to leverage their knowledge of C# or Visual Basic.NET when programming with ActiveReports.

In addition to a basic report designer for developers, ActiveReports also provides components that helps in exporting the reports to various formats viz PDF,RTF,HTML,Text,Excel. Also, it provides an End User Designer component that can be hosted on a Windows forms and pushed across to end users who can then design reports on their own. I take this opportunity to bring to notice some cool features of the product which I have managed to learn over a period of time working as a member of the team.