Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem passing report to viewer form

Status
Not open for further replies.

MrWombat

Programmer
May 14, 2003
4
AU
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;

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top