Crystal Report Displaying multiple data (Each row twice) .
-
Hi I am generating an report by using crystal report and access database in C#. the code which i have writeen works fine, but it displays multiple records. that is if there are two records to display it displays four records i.e it displays each record twice. i have executed the queries on the page load event in an dataset & binded that dataset to crystal report str1,str2,str3,str4 are the variables declared within constructor.the code i have written is displayed below. Thanks in advance. private void ViewPSDClearedReport_Load(object sender, EventArgs e) { try { crystalReportViewer1.DisplayGroupTree = false; if (str3 == "All") { //IF NO PURCHASE GROUP IS SELECTED MessageBox.Show("All"); ds = new DataSet(); rpt = new PSDClearedCrystalReport(); con = new OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data Source=e:/Ashish/Practice/ContractSystem/ContractSystem/ContractSystemDB.mdb"); con.Open(); cmd = new OleDbCommand("select * from PSDApproval where InitialPSD='" + str4 + "' and FwdDtByPSD between '" + str1 + "' and '" + str2 + "' order by FwdDtByPSD", con); rd = cmd.ExecuteReader(); if (rd.HasRows) { MessageBox.Show("Record present so reading"); while (rd.Read()) { string pr; pr = rd.GetString(0); MessageBox.Show("PR==" + pr); da = new OleDbDataAdapter("select PrNo,Description,ValueQuoted,PurchaseGrp,RcdDtEA,FwdDtPSD,Initial from InitialApproval where InitialApproval.PrNo='" + pr + "'", con); da.Fill(ds, "InitialApproval"); da.Dispose(); da1 = new OleDbDataAdapter("select EstimatedVal,FwdDtByPSD from PSDApproval where PSDApproval.PrNo='" + pr + "'", con); da1.Fill(ds, "PSDApproval"); da1.Dispose(); } } rpt.SetDataSource(ds); crystalReportViewer1.ReportSource = rpt; MessageBox.Show("Record Added To Report"); } else {