private void villageWiseAnshToolStripMenuItem_Click(object sender, EventArgs e) { if (cmbSelectDistrict.Text == "" || cmbSelectTehsil.Text == "" || cmbSelectGram.Text == "") { SqlConnection conn = new SqlConnection("Data Source=DESKTOP-DU76VKH\\SQLEXPRESS1;Initial Catalog=Rayedox_UPBhulekh_Agent;Integrated Security=True"); SqlCommand cmd; if (cmbCategory.Text.Trim() == "") { cmd = new SqlCommand("select * from AnshAgentScrappedData where District_Name=" + cmbSelectDistrict.Text + " and Tehsil_Name=" + cmbSelectTehsil.Text + " and Gram_Name=" + cmbSelectGram + "", conn); } else { cmd = new SqlCommand("select * from AnshAgentScrappedData where District_Name=" + cmbSelectDistrict.Text + " and Tehsil_Name=" + cmbSelectTehsil.Text + " and Gram_Name=" + cmbSelectGram + "and Category=" + cmbCategory.Text + "", conn); } SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet1 ds = new DataSet1(); da.Fill(ds.dsAnshAgentScrappedData); cmd.Dispose(); da.Dispose(); fetchedDataReport rpt = new fetchedDataReport(); rpt.SetDataSource(ds); this.Invoke(new MethodInvoker(delegate() { crystalReportViewer1.ReportSource = rpt; crystalReportViewer1.RefreshReport(); })); } else { MessageBox.Show("Please select District Name, Tehsil Name and Gram Name"); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { fetchedDataReport rpt = new fetchedDataReport(); rpt.Site = this.Site; return(rpt); }