Send query for Report

Stimulsoft Reports.NET discussion
Post Reply
eduardo12fox
Posts: 8
Joined: Fri Nov 22, 2019 9:20 pm

Send query for Report

Post 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
Lech Kulikowski
Posts: 7338
Joined: Tue Mar 20, 2018 5:34 am

Re: Send query for Report

Post by Lech Kulikowski »

Hello,

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

Thank you.
eduardo12fox
Posts: 8
Joined: Fri Nov 22, 2019 9:20 pm

Re: Send query for Report

Post 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?
Lech Kulikowski
Posts: 7338
Joined: Tue Mar 20, 2018 5:34 am

Re: Send query for Report

Post 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";
Post Reply