report does not update the data
Hello, I'll explain my problem.
When I created the report, I designed it and used it for the first time. It displays well, and when the information needs to change, it doesn't change. It always displays the information from the first time the report was used.
It's a stored procedure in SQL Server, which generates a report based on a sales ID that I send from C#.
From SQL Server, the query and what I want to show in the report work well, but it doesn't update. In the preview of the report design, everything works fine when I set the fixed parameters to test.
That code allows me to see the report in C# but it always shows the same information as when I used it.
I have other reports working and they show the information that is needed but I have problems with this one.
try
{
string rutaReporte = @"D:\WILLY\POS SWT\Sistema_para_restaurante_swt\PRESENTACION\REPORTES\RptComanda.frx";
Report report = new Report();
report.Load(rutaReporte);
// parámetro al reporte
report.SetParameterValue("IdVenta", idventa);
report.Prepare();
report.ShowPrepared();
}
catch (Exception ex)
{
MessageBox.Show("Error al cargar el informe: " + ex.Message);
}
That code allows me to see the report in C# but it always shows the same information as when I used it.
I have other reports working and they show the information that is needed but I have problems with this one.
This image is when I did it for the first time. I got the information I needed, but for each sale I have to generate the new information in the report. They are commands.
I repeat through SQL, everything works fine.
Comments
i have same problem
I cannot update dynamic data,
every time it reflects old design test data.
i ma passing JSON Data in dataset
string report_path = Server.MapPath("~/FastReportTemplate/");
using (Report report = new Report())
{
report.Load(report_path + "MDX_Online.frx");
report.Dictionary.ClearRegisteredData();
report.RegisterData(new List<ProductInfo> { productInfo }, "ProductInfo");
report.Prepare();
PDFExport pdfExport = new PDFExport();
string filename = "Test.pdf";
string pdfPath = report_path + filename;
report.Export(pdfExport, pdfPath);
report.Dispose();
}
Please, anyone can solve this issue.
Please suggest.
So just to be sure, I can't see it in the screenshots. You made a report, with a Query using an SQL Statement, in the next wizard step you set the SQL parameter Idventa takes it's value from a Report paramater, also called Idventa. You did not show that you have created a report paramater, and the statement report.SetParameterValue("IdVenta", idventa); will NOT generate an error when it does not find a Report parameter.
When you did not have this Report parameter the query will be executed with the hard-coded defaultvalue 1214 you configured.
That is not it. I just checked agian ans SetParamaterValue() also creates a paramater when it does not already exists.