Page 1 of 1

Send query for Report

Posted: Tue Feb 22, 2022 1:18 pm
by eduardo12fox
Hi guys,

I make a report in windows forms but I want send my query formatted for report how can send my query for parameters?
for exemple:

Code: Select all


	    strSQL = "SELECT * FROM financeiro where  ";

send for dataSource that report

Re: Send query for Report

Posted: Tue Feb 22, 2022 9:53 pm
by Lech Kulikowski
Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more detail?

Thank you.

Re: Send query for Report

Posted: Wed Feb 23, 2022 10:24 am
by eduardo12fox
When I build my report in Design mode, I use um dataSource and a query default. But in visual studio when I build my application I want build my query with any parameters and send this query from Report. How can set this new query in code windows form from Report? In PHP I did like this:

$sql = "SELECT * FROM financeiro_conta";

var report = new Stimulsoft.Report.StiReport();
report.setVariable("Parameters1", "<?php echo $DADOS1; ?>");
report.setVariable("Parameters2", "<?php echo $DADOS2; ?>");
report.setVariable("Parameters3", "<?php echo $DADOS3; ?>");

report.loadFile("Contas_a_Pagar.mrt");

report.dictionary.dataSources.list.find(x => x.name == 'DADOSGERAIS').sqlCommand = $sql;


In windows form .NET how did this?

Re: Send query for Report

Posted: Wed Feb 23, 2022 2:33 pm
by Lech Kulikowski
Hello,

You can use the following code:
((StiSqlDatabase)report.Dictionary.Databases[ "Connection"]).ConnectionString = "connection string";
((StiSqlSource)report.Dictionary.DataSources[ "DataSourceName"]).SqlCommand = "SQL query";