23 July 2016

Crystal Report in C#

1) Add Reference as following



2) Add Axcrviewer9Lib view in form from Toolbox and rename control to CRV


3) Then copy this to your code section

 private void print_Load(object sender, EventArgs e)
        {
            CRAXDRT.Application crep = new CRAXDRT.Application();
            CRAXDRT.Report frep = new CRAXDRT.Report();
            this.Text = "Test Print";
            frep = crep.OpenReport("D:/Sofwares/Adagu/loan_rep.rpt", 1);
            p1.cmd = new OleDbCommand("select *,'Loan Report' as rname from loan", p1.Cn);
            p1.rs = p1.cmd.ExecuteReader();
            p1.rs.Read();
            frep.Database.SetDataSource(p1.rs);
            CRV.ViewReport();
            MessageBox.Show("Printed Successful");
        }


For more Details Mail to murugankarthik008@gmail.com

No comments:

Post a Comment