| private void Form1_Load(object sender, EventArgs e) { //Instantiate a new report document ReportDocument oDoc = new ReportDocument(); //load myCrReport oDoc.Load(@"C:\myCrReport.rpt"); /* Create a data set and populate it with * C:\Ressource.xml contents*/ DataSet myDataSet = new DataSet(); myDataSet.ReadXml(@"C:\Ressource.xml"); // Set the data source of the report document oDoc.SetDataSource(myDataSet.Tables["Table"]); //Create a query to fit the user filtering requirement string myQuery = "{Stock.CodeStockPK} < 'STO0004'"; crystalReportViewer1.SelectionFormula = myQuery; //Set the viewer report source crystalReportViewer1.ReportSource = oDoc; } |