cancel
Showing results for 
Search instead for 
Did you mean: 

CRVS2010 Beta - Edit Sql query at runtine - update the datasource

Former Member
0 Kudos

Hello,

After ask your service through the thread : "CRVS2010 Beta - Edit Sql query at runtine ", I try an "other" solution to upgrade the query of my report at runtime : update the datasource (even if you told me that I should meet performance hits).

So I follow this guide : Link: [http://www.daniweb.com/forums/thread283806.html]

Here is a sample of what I wrote :

GroupPath gp = new GroupPath();

string sql = String.Empty;

Rpt.ReportClientDocument.RowsetController.GetSQLStatement(gp, out sql);

sql = sql.Replace("ORDER BY", "WHERE produit.gererproduit =1 AND CODEPRODUIT < 50 ORDER BY");

Rpt.SetDataSource((DataTable)Eskuel.Database.Querier.sourceFromSql(sql).DataSource);

For the test I try to update the report sql statement with a where clause ; with this test where clause, the query return only one product instead ofthe whole catalog (nearly 13000 products) ; but when I run the report I get all the product list ; moreover, the group filter on the left become totaly fault, as if they use the single product goup...

What did I do wrong?

Is there a report parameter to set?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello,

That code is using a report that has a Command Object as it's data source. It's the only data source that allows you to edit the SQL. If your reports are based on Tables, Stored Procedures etc. then it won't work nor do you have an option to modify the SQL directly.

Search forums also, I posted samples on how to convert a report based on 1 or 2 tables into reports based on Command Objects.

Thank you

Don

Answers (0)