Hi people
I have a little problem that i know has a simple answer but for the life of me i cant figure it out at the moment. I have two forms. Form1 collects the report parameters and creates the report object and sets the parameters for it. It then sends the report object to Form2 where it is set as the source for the report viewer. The thing is when run it returns a dialog box saying " Failed to open a rowset". It doesnt give any error message other than that so i dont know where i went wrong. Anyway here is a cut down version of the code. Any ideas?
FORM1
ParameterFieldDefinitions crPFDS;
ParameterFieldDefinition crPFD;
ReportClass myRep;
ParameterValues crPVS = new ParameterValues();
ParameterDiscreteValue crPDVS = new ParameterDiscreteValue();
myRep = new rpt_SettlementsByProject();
crPDVS.Value = 0;
crPFDS = myRep.DataDefinition.ParameterFields;
crPFD = crPFDS["@ReportParam"];
crPVS = crPFD.CurrentValues;
crPVS.Add(crPDVS);
crPFD.ApplyCurrentValues(crPVS);
Peet.frmReportPreview myReport = new Peet.frmReportPreview(myRep);
myReport.Show();
---------------------------------------------------------
FORM2 (frmReportPreview)
public frmReportPreview( ReportDocument myRep )
{
InitializeComponent();
crv1.ReportSource = myRep;
}
I have a little problem that i know has a simple answer but for the life of me i cant figure it out at the moment. I have two forms. Form1 collects the report parameters and creates the report object and sets the parameters for it. It then sends the report object to Form2 where it is set as the source for the report viewer. The thing is when run it returns a dialog box saying " Failed to open a rowset". It doesnt give any error message other than that so i dont know where i went wrong. Anyway here is a cut down version of the code. Any ideas?
FORM1
ParameterFieldDefinitions crPFDS;
ParameterFieldDefinition crPFD;
ReportClass myRep;
ParameterValues crPVS = new ParameterValues();
ParameterDiscreteValue crPDVS = new ParameterDiscreteValue();
myRep = new rpt_SettlementsByProject();
crPDVS.Value = 0;
crPFDS = myRep.DataDefinition.ParameterFields;
crPFD = crPFDS["@ReportParam"];
crPVS = crPFD.CurrentValues;
crPVS.Add(crPDVS);
crPFD.ApplyCurrentValues(crPVS);
Peet.frmReportPreview myReport = new Peet.frmReportPreview(myRep);
myReport.Show();
---------------------------------------------------------
FORM2 (frmReportPreview)
public frmReportPreview( ReportDocument myRep )
{
InitializeComponent();
crv1.ReportSource = myRep;
}