RegisterData problem
Hi everyone,
I am new to FastReports and have spent a whloe day to figure out how to bind a data source to teh report.
I use c# 2010.
The problem is as follows:
1) I have designed in design view a report and saved on disk as frx file.
2) I have added to my WinForm a Report control and a DataSet control, which I used to design the report. It has one static table with some 7 fields.
3) On a button clik (WinForm) event I try to populate the data set with records. In debug mode I see the data and the table in the dataset.
4) The problem is with the next step I do not get how to bind the dataset to the report during runtime (after fillin the data set with data).
The Button Click code:
this.ReportsPersonasKartina.Load("Reports/Protokoli_Search.frx");
Protokols.BindDataGrid(ref this.DataReportSearch); //This is where I populate the dataset
this.ReportsPersonasKartina.RegisterData(this.DataReportSearch, "Protokoli"); //DataReportSearch is my dtaset on the WinForm
FastReport.Data.DataSourceBase tables = this.ReportsPersonasKartina.GetDataSource("Protokoli"); // Table name "Protokoli" is defined in the dataset and is used the smae alias name and
//TableName in Report designer
tables.Enabled = true;
this.ReportsPersonasKartina.Show() //Here I get the exception
The StartReport event in the report
//FastReport.Data.DataSourceBase tables = Report.GetDataSource("Protokoli");
//tables.Enabled = true;
I tried it on both ButtonClick and the report side but got the same error all the time.
Can someone explain where the trick is?
Thank you in advance
I am new to FastReports and have spent a whloe day to figure out how to bind a data source to teh report.
I use c# 2010.
The problem is as follows:
1) I have designed in design view a report and saved on disk as frx file.
2) I have added to my WinForm a Report control and a DataSet control, which I used to design the report. It has one static table with some 7 fields.
3) On a button clik (WinForm) event I try to populate the data set with records. In debug mode I see the data and the table in the dataset.
4) The problem is with the next step I do not get how to bind the dataset to the report during runtime (after fillin the data set with data).
The Button Click code:
this.ReportsPersonasKartina.Load("Reports/Protokoli_Search.frx");
Protokols.BindDataGrid(ref this.DataReportSearch); //This is where I populate the dataset
this.ReportsPersonasKartina.RegisterData(this.DataReportSearch, "Protokoli"); //DataReportSearch is my dtaset on the WinForm
FastReport.Data.DataSourceBase tables = this.ReportsPersonasKartina.GetDataSource("Protokoli"); // Table name "Protokoli" is defined in the dataset and is used the smae alias name and
//TableName in Report designer
tables.Enabled = true;
this.ReportsPersonasKartina.Show() //Here I get the exception
The StartReport event in the report
//FastReport.Data.DataSourceBase tables = Report.GetDataSource("Protokoli");
//tables.Enabled = true;
I tried it on both ButtonClick and the report side but got the same error all the time.
Can someone explain where the trick is?
Thank you in advance