Fast Report and Stored Procedure
Hi everyone, I am trying to set fast-report data-set (Data-tables) using MSSQL Server Stored Procedure, Here is what is did:
1. I create a empty report template with data-source place holder:
2. I get necessary information for report with some code below:
3. I Register dataset for this report:
4. To make sure I did right thing, I save current Report and open it with fast-report designer:
The Problems is: The table queried by stored procedure is empty (columns) but table instance still exist, What Wrong???
Hope some help, thank every one
1. I create a empty report template with data-source place holder:
2. I get necessary information for report with some code below:
// Get necessary report information
                        DataTable TicketDetailDataTable = entities.Database.SqlQuery<PrintMixingreport1_Result>(
                            $"EXEC {reportConfig.SqlProcedureName} @CodePlant,@Plant_No,@St_Ticket",
                            new SqlParameter("CodePlant", plantCode), new SqlParameter("Plant_No", plantNo),
                            new SqlParameter("St_Ticket", ticketNo)).ToDataTable();
                        DataTable SheetDataTable = entities.Ticket.Where(x =>
                                x.CodePlant == plantCode && x.Plant_No == plantNo && x.Ticket_No == ticketNo.ToString())
                            .ToDataTable();
I using moreLinq Nuget package, I had noticed that 2 table has rows.3. I Register dataset for this report:
DataSet ReportDataSet = new DataSet();
            foreach (var key in ReportDataSourceDictionary.Keys)
            {
                ReportDataSourceDictionary[key].TableName = key;
                ReportDataSet.Tables.Add(ReportDataSourceDictionary[key]);
            }
            report.RegisterData(ReportDataSet);
            return report;
4. To make sure I did right thing, I save current Report and open it with fast-report designer:
report.Save(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "App_Data", "Reports",
                            "ReportTemplates", "templateDebug.frx"));
The Problems is: The table queried by stored procedure is empty (columns) but table instance still exist, What Wrong???
Hope some help, thank every one