Closed arisrell closed 8 years ago
You can use Parameters property of Control to set parameters from code in Release version. And you can use SetReportParametersAmpersandSeparated, SetReportParametersAsJson and SetReportParameters functions to set parameters in version from git.
I did use the parameters property. I even added a textbox on the report to see if the parameters are being received and it does. It just that it was not using the parameter in the connectionstring it's trying to use the variable name as the connectionString. In other words, it is not substituting the value.
Perhaps i don't understand what you mean. Are you want set ConnectionString from report parameters? Like there https://github.com/majorsilence/My-FyiReporting/wiki/Set-Connection-String---Runtime Or are you want set ConnectionString directly? Like this implemented in GTKViewer? Set ConnectionString from code. I see that second case didn’t implemented in Winforms Control.
And i didn't understand what you mean when say this is works for RdlReader.exe? Can you explain more detail how you use it with RdlReader.exe?
Hi
Thanks again for your response.
So I have an rdl report and in that report's DataSource window -->ConnectionString box, I used a parameter, ={?ConnectionString}.
I have a winform as below:
public partial class frmReportViewer : Form
{
private string ReportName;
private string ReportParameters;
public frmReportViewer(string rptName, string rptParam)
{
InitializeComponent();
ReportName = rptName;
ReportParameters = rptParam;
}
private void frmReportViewer_Load(object sender, EventArgs e)
{
this.BringToFront();
ShowReport();
}
private void ShowReport()
{
fyiReporting.RdlViewer.ViewerToolstrip vts = new fyiReporting.RdlViewer.ViewerToolstrip();
fyiReporting.RdlViewer.RdlViewer rdlViewer1 = new fyiReporting.RdlViewer.RdlViewer();
vts.Viewer = rdlViewer1;
vts.Dock = DockStyle.Top;
rdlViewer1.Dock = DockStyle.Fill;
Uri pth = new Uri(ReportName);
rdlViewer1.SourceFile = pth;
// pth = "[path]/customer.rdl"
rdlViewer1.Parameters = ReportParameters;
//ReportParameters = "ConnectionString=\"server=10.1.1.254;user id=user;password=user;database=testdb;Port=3306;pooling=false;\"";
rdlViewer1.Rebuild();
this.panel1.Controls.Add(vts);
this.panel2.Controls.Add(rdlViewer1);
}
}
The embedded Report Viewer above can not connect to the MySQL server for some reason.
However, using the RdlReader.exe in a source code works for the same rdl report and parameter. string prm = "-r [path]/customer.rdl -p "; prm += "ConnectionString=\"server=10.1.1.254;user id=user;password=user;database=testdb;Port=3306;pooling=false;\"";
System.Diagnostics.Process.Start("[path]/RdlReader/RdlReader.exe", prm);
Thank you very much in advance if you can let me what I am doing wrong.
I figured it out. When using RdlViewer, do not include the escaped quotes around the entire connection string. But still have an issue using RdlViwer in OSX, it's just too slow with mono. Anyway, the best option form me is to use a Report Server in LAMC#, Linux/Apache/MySQL/C# with mod_mono. This way the report will be accessed using a web browser instead.
I used a parameter in a MySQL.NET Datasource ConnectionString in an rdl report. The reports works fine when used with RdlReader.exe. But does not work when using RdlViewer control in a Winform. I need to use an embedded report viewer in a winform. How can I pass a parameter for the connection string for MySQL.NET Datasource to the rdlViewer control?