2
votes

I am creating a crystal reports using Visual Studio 2010 and using ADO Dataset for database field on report. now i want to set default 2 copies of bill on print button on crystal report viewer. code which i have written on crystal report viewer load is

Report.Bill objRpt = new Report.Bill();
objRpt.SetDataSource(DT1);
objRpt.PrintToPrinter(2, true, 0, 0);
crystalReportViewer1.ReportSource = objRpt;
crystalReportViewer1.Refresh(); 

But it is printing only single copy of bill. Can anyone tell me how can I fix that? I am very new in crystal reports.

1

1 Answers

0
votes
private void button1_Click(object sender, EventArgs e)
    {
        SqlCommand cmd = new SqlCommand("//Your Query//");
        //SqlCommand cmd = new SqlCommand();
        //cmd.CommandText = "GetSalesCrystalReport";
        //cmd.CommandType = CommandType.StoredProcedure;
        //cmd.Parameters.AddWithValue("@ReferenceNo", txtReferenceNo.Text);
        DataTable dt1 = DataManager.GetDataTable(cmd);
        Sales objRpt3 = new Sales();
        objRpt3.SetDataSource(dt1);
        objRpt3.PrintToPrinter(1, false, 0, 0);

    }