ActiveReports for .NET 3 Online Help Request technical support
Using a Dataset
See Also
User Guide > How-To Section > Binding Reports to a Data Source > Using a Dataset

Glossary Item Box

In addition to being able to set the report's data source with the DataSource icon, ActiveReports for .NET 3.0 allows you to use the dataset and other .NET data components directly within the ActiveReport environment. To use a dataset at design time, add the necessary data controls to the ActiveReport, set the report's DataSource and DataMember properties, and bind the report's controls to the corresponding data fields

If your project already contains a dataset that you want to use within the ActiveReport designer, drag the DataSet object from the Data tab of the toolbox onto the report surface. This will open the Add Dataset dialog. To add your dataset, select the Typed dataset option then choose your dataset.

To add data controls to the ActiveReport

  1. While in an ActiveReport, click the Data toolbox tab. Select any available DataAdapter object and drag it onto the report surface; the Data Adapter Configuration Wizard will open and you will see a visual representation of the DataAdapter object in the ActiveReports component tray. 
  2. Click Next
  3. Click New Connection, which will open the Data Link Properties dialog, and select the "Provider" tab.
  4. Select the appropriate provider.
  5. Select the "Connection" tab and enter or browse for the path to the desired database file and click OK to close the dialog and return to the Configuration Wizard.
  6. Click Next twice, enter the appropriate SQL Select statement and click the Next button again.
  7. Click Finish to close the wizard. A connection object will now reside with the DataAdapter object in the ActiveReports component tray.
  8. To generate the dataset, right-click the DataAdapter object, click on "Generate DataSet," select "Add this dataset the the designer," and click OK.

To set the report's DataSource and DataMember properties 

  1. Click in the gray area of the design area to select the ActiveReport.
  2. From the Properties grid, set the DataSource property to the newly generated dataset and the DataMember to the DataTable.

After setting the report's data source, all bound fields appear under the Bound node, which is accessed by expanding the Fields node in the Report Explorer.

     

To bind the report's controls to the corresponding data fields

    You can quickly bind an ActiveReports TextBox control to any field by directly dragging the field from the Report Explorer onto the ActiveReport design surface.
  1. Write code to fill the dataset. In this case, the dataset is filled during the ReportStart_Event.
'Visual Basic
Private Sub rptDataSet_ReportStart(ByVal sender As System.Object, ByVal e As System.EventArgs)_
    Handles MyBase.ReportStart
        Me.OleDbDataAdapter1.Fill(Me.DataSet11.Employees)
    End Sub
    
//C#
private void rptDataSet_ReportStart(object sender, System.EventArgs e)
    {
	this.oleDbDataAdapter1.Fill(this.dataSet11.Employees);
    } 

    See Also

    ©2009. All Rights Reserved.