Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Passes a Recordset or Dataset to the report engine.
Overload List
| Description | |
|---|---|
| Table.SetDataSource Method (Object) | Passes a Recordset or Dataset to the report engine. |
| Table.SetDataSource Method (System.Data.IDataReader) | Passes a IDataReader to the report engine. |
| Table.SetDataSource Method (System.Data.DataTable) | Passes a DataTable to the report engine. |
| Table.SetDataSource Method (System.Data.DataSet) | Passes a Recordset or Dataset to the report engine. |
Example
The following example creates a dataset and passes it to the Customer table. The method uses the ADO.NET object model to set up the connection information. The method then connects to the data source, fetches the data, and disconnects from the datasource. Finally, the populated dataset is passed to the Customer table.
'Declaration
Private Function SetDataSource _
(ByVal conn As String, ByVal query As String, _
ByVal dataSet As DataSet)
Dim oleConn As New OleDbConnection(conn)
Dim oleAdapter As New OleDbDataAdapter()
oleAdapter.SelectCommand = New OleDbCommand(query, oleConn)
oleAdapter.Fill(dataSet, "Customer")
myReportDocument.Database.Tables.Item("Customer").SetDataSource(dataSet)
End Function
void SetDataSource(String* conn, String* query, DataSet* dataSet)
{
OleDbConnection* oleConn =
new OleDbConnection(conn);
OleDbDataAdapter* oleAdapter = new OleDbDataAdapter();
oleAdapter->SelectCommand = new OleDbCommand(query, oleConn);
oleAdapter->Fill(dataSet, "Customer");
reportDocument->Database->Tables->
Item["Customer"]->SetDataSource(dataSet);
};
private void SetDataSource
(string conn, string query, DataSet dataSet)
{
OleDbConnection oleConn = new OleDbConnection(conn);
OleDbDataAdapter oleAdapter = new OleDbDataAdapter();
oleAdapter.SelectCommand = new OleDbCommand(query, oleConn);
oleAdapter.Fill(dataSet, "Customer");
reportDocument.Database.Tables["Customer"].SetDataSource (dataSet);
}
See Also
Reference
Table Class
Table Members
CrystalDecisions.CrystalReports.Engine Namespace