MaxDembo81
11-10-2011, 11:36
Salve a tutti,
ho una domanda sui report perchè mi sono infilato in un ginepraio e non riesco a uscirne.
Avevo strutturato la mia soluzione in 4 progetti distinti:
-Forms
-Repository Entity Framework
-Modello del Db
-Reporting
I report sono .rdlc fatti col wizard a partire da delle stored procedure presenti sul DB.
La mia idea era di usare il progetto Reporting come Class Library dove volevo mettere esclusivamente i Report che sarebbero stati utilizzati dal progetto WinForm con un ReportViewer.
Nel progetto reporting avevo creato un nuovo Dataset (quindi non usavo il Model.edmx fatto con EntityFramework e presente nel terzo progetto) e funzionava tutto bene solo che non son riuscito a collegare il winform con il file rdlc.
Questo il codice che non va:
System.Windows.Forms.BindingSource spReport_R01_OreBindingSource;
BB.GeMeCo.Reporting.MethodoDbDataSet MethodoDbDataSet;
BB.GeMeCo.Reporting.MethodoDbDataSetTableAdapters.spReport_R01_OreTableAdapter spReport_R01_OreTableAdapter;
Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
spReport_R01_OreBindingSource = new System.Windows.Forms.BindingSource(this.components);
MethodoDbDataSet = new BB.GeMeCo.Reporting.MethodoDbDataSet();
spReport_R01_OreTableAdapter = new BB.GeMeCo.Reporting.MethodoDbDataSetTableAdapters.spReport_R01_OreTableAdapter();
spReport_R01_OreBindingSource.DataMember = "spReport_R01_Ore";
spReport_R01_OreBindingSource.DataSource = MethodoDbDataSet;
spReport_R01_OreTableAdapter.ClearBeforeFill = true;
MethodoDbDataSet.DataSetName = "MethodoDbDataSet";
MethodoDbDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
reportDataSource1.Name = "DataSet1";
reportDataSource1.Value = spReport_R01_OreBindingSource;
reportViewer1.LocalReport.DataSources.Add(reportDataSource1);
reportViewer1.LocalReport.LoadReportDefinition(stream);
reportViewer1.LocalReport.ReportEmbeddedResource = "BB.GeMeCo.Reporting.R01-Ore.rdlc";
this.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayM
ode.PrintLayout);
this.reportViewer1.RefreshReport();
Mi dice che non trova la definizione di R01-Ore.rdlc....
Allora ho deciso di eliminare il progetto Reporting e fare tutti nel progetto Winform.
A questo punto mi son detto? Perchè creare un nuovo Dataset quando ho già il mio Model EntityFramework?
Solo che quando clicco su "Design New Report" e scelgo il Dataset mi fa vedere le Classi mappate dalle tabelle del DB ma non le Stored Procedure.
Cosa devo fare? Che passaggio mi manca?
Grazie!
ho una domanda sui report perchè mi sono infilato in un ginepraio e non riesco a uscirne.
Avevo strutturato la mia soluzione in 4 progetti distinti:
-Forms
-Repository Entity Framework
-Modello del Db
-Reporting
I report sono .rdlc fatti col wizard a partire da delle stored procedure presenti sul DB.
La mia idea era di usare il progetto Reporting come Class Library dove volevo mettere esclusivamente i Report che sarebbero stati utilizzati dal progetto WinForm con un ReportViewer.
Nel progetto reporting avevo creato un nuovo Dataset (quindi non usavo il Model.edmx fatto con EntityFramework e presente nel terzo progetto) e funzionava tutto bene solo che non son riuscito a collegare il winform con il file rdlc.
Questo il codice che non va:
System.Windows.Forms.BindingSource spReport_R01_OreBindingSource;
BB.GeMeCo.Reporting.MethodoDbDataSet MethodoDbDataSet;
BB.GeMeCo.Reporting.MethodoDbDataSetTableAdapters.spReport_R01_OreTableAdapter spReport_R01_OreTableAdapter;
Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
spReport_R01_OreBindingSource = new System.Windows.Forms.BindingSource(this.components);
MethodoDbDataSet = new BB.GeMeCo.Reporting.MethodoDbDataSet();
spReport_R01_OreTableAdapter = new BB.GeMeCo.Reporting.MethodoDbDataSetTableAdapters.spReport_R01_OreTableAdapter();
spReport_R01_OreBindingSource.DataMember = "spReport_R01_Ore";
spReport_R01_OreBindingSource.DataSource = MethodoDbDataSet;
spReport_R01_OreTableAdapter.ClearBeforeFill = true;
MethodoDbDataSet.DataSetName = "MethodoDbDataSet";
MethodoDbDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
reportDataSource1.Name = "DataSet1";
reportDataSource1.Value = spReport_R01_OreBindingSource;
reportViewer1.LocalReport.DataSources.Add(reportDataSource1);
reportViewer1.LocalReport.LoadReportDefinition(stream);
reportViewer1.LocalReport.ReportEmbeddedResource = "BB.GeMeCo.Reporting.R01-Ore.rdlc";
this.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayM
ode.PrintLayout);
this.reportViewer1.RefreshReport();
Mi dice che non trova la definizione di R01-Ore.rdlc....
Allora ho deciso di eliminare il progetto Reporting e fare tutti nel progetto Winform.
A questo punto mi son detto? Perchè creare un nuovo Dataset quando ho già il mio Model EntityFramework?
Solo che quando clicco su "Design New Report" e scelgo il Dataset mi fa vedere le Classi mappate dalle tabelle del DB ma non le Stored Procedure.
Cosa devo fare? Che passaggio mi manca?
Grazie!