public void Read(string srr) { SqlConnection conn = new SqlConnection(this.connectionString); SqlCommand comm = new SqlCommand("SELECT *FROM TbDailyIncome WHERE VoucherNo = @VoucherNo ORDER BY VoucherNo", conn); comm.Parameters.Add("@VoucherNo", SqlDbType.VarChar, 50); comm.Parameters["@VoucherNo"].Value = comboBox1.Text; SqlDataAdapter adap = new SqlDataAdapter(); DataSets.DebitVoucherDataSet dataset = new DataSets.DebitVoucherDataSet(); DebitVoucherBySLNoCrystalReport crp = new DebitVoucherBySLNoCrystalReport(); try { conn.Open(); adap.SelectCommand = comm; adap.Fill(dataset, "DataTable1"); crp.SetDataSource(dataset); crystalReportViewer2.ReportSource = crp; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { conn.Close(); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { DebitVoucherBySLNoCrystalReport rpt = new DebitVoucherBySLNoCrystalReport(); rpt.Site = this.Site; return rpt; }