Error CS0103: The name 'DataSet' does not exist in the current context
Hi,
First time user. I've setup my report nicely. It runs and previews perfectly in the Community designer. Then I try to run it from C# code and it just gives the following error.
Error CS0103: The name 'DataSet' does not exist in the current context
I'm not registering data, but I shouldn't have to if it's all setup in the report, correct? I've checked the Databand, and checked the XML. All looks fine. Created a new report using the Wizard, same issue.
Report report = new Report();
report.Load("C:\\temp\\untitled.frx");
report.Prepare();
Thanks
This discussion has been closed.
Comments
Hello!
If you are using a built-in database connection within the .frx file (SQLite, MS SQL, XML, etc.), please ensure that the relevant connector plug-in has been added to and registered in your C# application (FastReport.Data.* + RegisteredObjects.AddConnection(...)), otherwise the connection will not be loaded at runtime.
Alternatively, populate the DataTable/DataSet in your C# code and, before calling `Prepare()`, register it with the same name as in the .frx file: `report.RegisterData(dt, ‘DataSet’);` `report.GetDataSource(‘DataSet’).Enabled = true;`