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

Glossary Item Box

In addition to using a dataset, the report's data source can be set to a data view. This can be useful for creating reports containing filtered information. To use the data view in the report, set the report's DataSource property to the data view created from the filtered dataset.

The following example shows what the code for the method looks like.

'Visual Basic
Dim m_dbPath As String
Dim usView As New DataView()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
   Handles MyBase.Load
   m_dbPath = getDatabasePath()
   Me.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;_
     Data Source=" + m_dbPath + "\\Northwind.mdb;Persist Security Info=False"
   Me.oleDbDataAdapter1.Fill(Me.dataSet11)
   usView = me.dataSet11.Tables("employees"))
   usView.RowFilter = "Country = 'USA'"
   Dim arReport As New ActiveReport1
   Me.arReport.DataSource = usView
End Sub

//C#
DataView usView;
private void Form1_Load(object sender, System.EventArgs e)
{
   string m_dbPath = getDatabasePath();	
   this.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;
	Data Source=" + m_dbPath + "\\Northwind.mdb;Persist Security Info=False";
   this.oleDbDataAdapter1.Fill(this.dataSet11);
   usView = new DataView(this.dataSet11.Tables["employees"]);
   usView.RowFilter = "Country ='USA'";
   ActiveReport arReport = new ActiveReport;
   this.arReport.DataSource = usView;
}

See Also

©2009. All Rights Reserved.