Working with object datasource using stimulsoft reports.net
Posted: Thu May 14, 2009 2:27 am
Hi All,
As we know that we can bind a stimulsoft report(.mrt file) with sql query and then assign to report designer in the following way
report.Load(path);
//get connection string from web.config file
string connectionString = "connection string is given here"
//write query
string sqlQuery = "Select * from Products";
//create data source and connect the report using the connection string
StiSqlSource myDataSource = new StiSqlSource("MyConnection", "myDataSource", "myDataSource", sqlQuery);
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new StiSqlDatabase("MyConnection", connectionString));
report.Dictionary.DataSources.Clear();
report.Dictionary.DataSources.Add(myDataSource);
report.Dictionary.Synchronize();
report.Dictionary.Connect();
report.DataSources["myDataSource"].SynchronizeColumns();
//assign to stimulsoft report designer
StiWebDesigner1.Design(report);
Doing the above will open the report in stimulsoft report designer, where we can drag drop datasource fields to design the report and then can save the report.
My problem is that I want to provide object dataSource instead of the sql query and connection.
I've a business class which returns me the collection of whole of the data. So how I can use the fields of my business class in the report designer?
In other words, how I can use object datasource for designing the reports in stimulsoft designer dynamically?
Please reply me asap, so that I can come out of this problem asap.:emb:
As we know that we can bind a stimulsoft report(.mrt file) with sql query and then assign to report designer in the following way
report.Load(path);
//get connection string from web.config file
string connectionString = "connection string is given here"
//write query
string sqlQuery = "Select * from Products";
//create data source and connect the report using the connection string
StiSqlSource myDataSource = new StiSqlSource("MyConnection", "myDataSource", "myDataSource", sqlQuery);
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new StiSqlDatabase("MyConnection", connectionString));
report.Dictionary.DataSources.Clear();
report.Dictionary.DataSources.Add(myDataSource);
report.Dictionary.Synchronize();
report.Dictionary.Connect();
report.DataSources["myDataSource"].SynchronizeColumns();
//assign to stimulsoft report designer
StiWebDesigner1.Design(report);
Doing the above will open the report in stimulsoft report designer, where we can drag drop datasource fields to design the report and then can save the report.
My problem is that I want to provide object dataSource instead of the sql query and connection.
I've a business class which returns me the collection of whole of the data. So how I can use the fields of my business class in the report designer?
In other words, how I can use object datasource for designing the reports in stimulsoft designer dynamically?
Please reply me asap, so that I can come out of this problem asap.:emb: