Error: Table is not connected to the data ...
I'm getting this error
"Data: Table is not connected to the data. Register the data using Report.RegisterData method."
I'm using:
* Visual Studio 2010 (Express)
* Reports storeds in resources (StoredInResources=true)
* Using OleDb to connect and load from DB (Interbase)
My pcode:
// Connect to DB
OleDBConnection DBConnection = ...
// Build SQL Select
SQLCommand = "select ... from ...";
// Create adapter to load data
OleDbAdapter dataAdapter = new OleDbAdapter(SQLCommand, DBConnection);
// Fill into table "Data"
dataAdapter.Fill(dataSet1, "Data"); // dataSet1 is one-table only!
// Register data
report1.RegisterData(dataSet1);
// Show report
report1.Show(); // Error here!
In design
* dataSet1 is a DataSet object
* dataSet1 has a one table "Data" with column definitions (for easy use in FR designer)
My report (object report1) from .resx (not .frx)
<Dictionary>
<TableDataSource Name="Data" ReferenceName="dataSet1.Data" DataType="System.Int32" Enabled="true">
<Column Name="COL1" DataType="System.String"/>
<Column Name="COL2" DataType="System.Int32"/>
...
...
<DataBand Name="Data1" Top="171.08" Width="718.2" Height="15.12" DataSource="Data">
...
Maybe I'm confused using DataSet and datatable name, or registering DataSet/DataTable ??
"Data: Table is not connected to the data. Register the data using Report.RegisterData method."
I'm using:
* Visual Studio 2010 (Express)
* Reports storeds in resources (StoredInResources=true)
* Using OleDb to connect and load from DB (Interbase)
My pcode:
// Connect to DB
OleDBConnection DBConnection = ...
// Build SQL Select
SQLCommand = "select ... from ...";
// Create adapter to load data
OleDbAdapter dataAdapter = new OleDbAdapter(SQLCommand, DBConnection);
// Fill into table "Data"
dataAdapter.Fill(dataSet1, "Data"); // dataSet1 is one-table only!
// Register data
report1.RegisterData(dataSet1);
// Show report
report1.Show(); // Error here!
In design
* dataSet1 is a DataSet object
* dataSet1 has a one table "Data" with column definitions (for easy use in FR designer)
My report (object report1) from .resx (not .frx)
<Dictionary>
<TableDataSource Name="Data" ReferenceName="dataSet1.Data" DataType="System.Int32" Enabled="true">
<Column Name="COL1" DataType="System.String"/>
<Column Name="COL2" DataType="System.Int32"/>
...
...
<DataBand Name="Data1" Top="171.08" Width="718.2" Height="15.12" DataSource="Data">
...
Maybe I'm confused using DataSet and datatable name, or registering DataSet/DataTable ??
Comments
When I run the project however, Apatar is not clearing the data in the Salesforce table.
Any thoughts?
ReferenceName and RegisterData must match
in report :
<TableDataSource Name="Data" ReferenceName="dataSet.Data" DataType="System.Int32" Enabled="true">
in c# code ...
report.RegisterData(dataSet, "dataSet");