OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["ConString"].ToString()); OleDbCommand com; OleDbDataAdapter adp = new OleDbDataAdapter(); DataSet ds = new DataSet(); public Form1() { InitializeComponent(); } private void btn_view_Click(object sender, EventArgs e) { if (txt_vc_code.Text == "") { MessageBox.Show("Enter Voucher Code"); } else { //ds.Tables[0].Rows.Clear(); //ds.Tables["payment_voucher,Branch_Master"].Rows.Clear(); adp = new OleDbDataAdapter("select p.*,b.* from payment_voucher as p inner join Branch_Master as b on b.branch_code =p.branch_code where p.voucher_code='" + txt_vc_code.Text + "'", con); DataSet ds2 = new DataSet(); adp.Fill(ds2, "payment_voucher,Branch_Master"); ReportDocument rd = new ReportDocument(); rd.Load("E:\\Vertex_app\\VertexApp\\VertexApp\\Payment_Voucher_rpt.rpt"); rd.SetDataSource(ds.Tables["payment_voucher,Branch_Master"]); crystalReportViewer1.ReportSource = rd; } } private void Form1_Load(object sender, EventArgs e) { CrystalAddData(); } public void CrystalAddData() { adp = new OleDbDataAdapter("select p.*,b.* from payment_voucher as p inner join Branch_Master as b on b.branch_code =p.branch_code", con); adp.Fill(ds); ReportDocument rd = new ReportDocument(); rd.Load("E:\\Vertex_app\\VertexApp\\VertexApp\\Payment_Voucher_rpt.rpt"); rd.SetDataSource(ds.Tables["payment_voucher,Branch_Master"]); crystalReportViewer1.ReportSource = rd; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)