public void Print(String ProductID, String ProductID_2, Boolean isLanded) // Product Listing Report { String Sql = ""; if (ProductID.Trim().Length > 0 && ProductID_2.Trim().Length > 0) { Sql = String.Format(" And ProductID >='{0}' And ProductID<='{1}' ", ProductID, ProductID_2); } if (ProductID.Trim().Length > 0 && ProductID_2.Trim().Length == 0) { Sql = String.Format(" And ProductID ='{0}'", ProductID); } frmViewReport oViewReport = new frmViewReport(); ItemListing oRpt = new ItemListing(); ItemListingLandedCost oRpt_1 = new ItemListingLandedCost(); DataSet ds = new DataSet(); if (isLanded) { ds.Tables.Add(oMySql.GetDataTable("Select ProductID, Description, Size,VendorItem,ONPO,Commited,Sold,Received,p.UnitCost as Cost From Product p Where CompanyID='" + CompanyID + "'" + Sql, "Product")); } else { ds.Tables.Add(oMySql.GetDataTable("Select p.*,p.Cost as FinalCost From Product p Where CompanyID='" + CompanyID + "'" + Sql, "Product")); } // ds.WriteXml("dataset1002.xml", XmlWriteMode.WriteSchema); oRpt.SetDataSource(ds); //oRpt.PrintToPrinter(1, true, 1, 100); if (isLanded) { oRpt.SetParameterValue("Title", "ITEM LISTING LANDED COST"); oViewReport.cReport.ReportSource = oRpt; } else { oRpt.SetParameterValue("Title", "ITEM LISTING"); oViewReport.cReport.ReportSource = oRpt; } oViewReport.ShowDialog(); }