Click here to Skip to main content
15,889,879 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,

I've written a code to display certain fileds on crystal report from db.
Its working, bur now I'm having problem with printing it. What I'm looking for is actually to set a textbox value as copies. For example trolley = 5 units. The crystal report should print 5 copies. But now its not printing more than one copy

What I have tried:

PT_Main ptm = new PT_Main();

          conn.ConnectionString = ConfigurationManager.ConnectionStrings["MMS_JJ.Properties.Settings.MMSBOMConnectionString"].ToString();
          string sql = "SELECT * From QRStore where BomTransactionID = '" + int.Parse(comboBox1.Text) + "' ";
          string sqlo = "SELECT * From QRStore where BomTransactionID = '" + int.Parse(comboBox2.Text) + "' ";
          string sqli = "SELECT * From QRStore where BomTransactionID = '" + int.Parse(comboBox3.Text) + "' ";
          DataSet ds = new DataSet();
          DataSet dso = new DataSet();
          DataSet dsi = new DataSet();

          SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
          SqlDataAdapter adapter1 = new SqlDataAdapter(sqlo, conn);
          SqlDataAdapter adapter2 = new SqlDataAdapter(sqli, conn);
          var ncopies = Int32.Parse(trllyTextBox.Text);

          adapter.Fill(ds, "QRStore");
          adapter1.Fill(dso, "QRStore");
          adapter2.Fill(dsi, "QRStore");
          ptm.Subreports[0].SetDataSource(ds.Tables["QRStore"]);
          ptm.Subreports[1].SetDataSource(dso.Tables["QRStore"]);
          ptm.Subreports[2].SetDataSource(dsi.Tables["QRStore"]);
          crystalReportViewer1.ReportSource = ptm;
          crystalReportViewer1.Refresh();

          ptm.PrintToPrinter(Convert.ToInt32(trllyTextBox.Text),false,0,0);
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900