I am using the DevExpress Xtrareport feature
Please bare with me for the scenario.
I can use the following construct to link the devart produced model to the report
//I use NoRows to restrict the data returned when providing the report writer with the model structure
//There is a small number when testing the report
//It is then the number of rows in the table for the full report
var query = (from client in ReportDataConnection.TblClientHead
select client).Take(noRows);
xrDesignPanel1.Report.DataSource = query1;
The report shows the model centered around my table and it has the data from the main table (TblClientHead) but the data from the linked tables is not auto loaded.
I read that BindingSource has a CurrentChanged event which can have code to load the linked tables as the record of the main table changes.
This gives me the procedure
private void bs_CurrentChanged(object sender, EventArgs e)
{
BindingSource bs = ((BindingSource)sender);
var c = ((TblClientHead)bs.Current);
c.TblJobsHeads.Load();
}
Seems sensible. But now to the crucial line.
I need to link a BindingSource object to the dataset produced in the query. I have been told to use the construct
BindingSource bs = (BindingSource)xrDesignPanel1.Report.DataSource;
But this produces the error
{"Unable to cast object of type 'System.Data.Objects.ObjectQuery`1[KF.Jobs.Model.TblClientHead]' to type 'System.Windows.Forms.BindingSource'."}
This implies that the Devart produced dataobject is not compatible with BindingSource or I am misunderstanding this, new to me, syntax and grammar.
If someone can point me in the right direction I would be most greatful.
Regards
