public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { prnt_all rpt = new prnt_all(); rpt.Site = this.Site; return(rpt); }
private void crystalReportViewer1_Load(object sender, EventArgs e) { textBox1.Text = txtprint; textBox2.Text = txtprint1; textBox3.Text = txtprint2; textBox4.Text = txtprint3; prnt_all un = new prnt_all(); SqlConnection cn = new SqlConnection(CDatabase.ConnectionStr); cn.Open(); SqlCommand cmd = new SqlCommand("USP_GET_ID", cn); SqlCommand cmd1 = new SqlCommand("USP_GET_ID1", cn); SqlCommand cmd2 = new SqlCommand("USP_GET_ID2", cn); SqlCommand cmd3 = new SqlCommand("USP_GET_ID3", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@P_ID", textBox1.Text); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@P_ID1", textBox2.Text); cmd2.CommandType = CommandType.StoredProcedure; cmd2.Parameters.AddWithValue("@P_ID2", textBox3.Text); cmd3.CommandType = CommandType.StoredProcedure; cmd3.Parameters.AddWithValue("@P_ID3", textBox4.Text); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); un.SetDataSource(dt); crystalReportViewer1.ReportSource = un; crystalReportViewer1.Refresh(); //un.PrintOptions.PrinterName = "HP LaserJet 1020 (Copy 2)"; //un.PrintOptions.PrinterName = "HP LaserJet 1020"; // un.PrintOptions.PrinterName = "Microsoft Print to PDF"; // un.PrintToPrinter(1, false, 1, 6); cn.Close(); }