How to use internal data source in a FastReport .NET report

If you create a report along with the client application, it is logical to create a single source of data in a program and use it in many reports.

This article will focus on the connection of the report FastReport .NET applications to the data source.

It is best to demonstrate the process by an example. Create application Windows Forms. Add the data source to the program. In my case - the database xml.


Now add a dataset component to the form from the toolbox. Select the typed dataset.


All that's left to do is to create a report and register the data source in it.

Add a button and the Report component from the toolbar.

Double-click on the component report1 to open the report designer. But first, choose a data source applications:


Create a simple report with the list in the designer:


The list of available data sources can be seen by clicking on the icon (highlighted in red):


The window appears:


Save the report and return to the application. Add the button click event handler:

 private void button1_Click(object sender, EventArgs e)
 report1.Load(Environment.CurrentDirectory + "/Report.frx");

 Do not forget to add the FastReport library in using. Here we load the report file. Then, register the data source in the report. And run a report in preview mode.


RegisterData function allows you to register: DataSet, DataTable, DataView, DataRelation, IEnumerable. The latter one may be a list of objects (including any embedded objects) or, for example, the result of LINQ query. It is important to register the data in the report after loading the report and before viewing or exporting.

Using a data source from the application, it allows us to avoid the need to create a database connection in each report. Besides, if it necessary to change the settings you need edit one connection only.

Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.