Connection.openconnection(); for (int c = 0; c < dataGridView1.Rows.Count - 1; c++) { SqlDataAdapter da = new SqlDataAdapter("select * from student_details,institution_details where current_class='" + this.dataGridView1.Rows[c].Cells[0].Value + "'", Connection.con); DataSet ds = new DataSet(); da.Fill(ds, "classlist"); ReportDocument bkng = new ReportDocument(); bkng.Load(Application.StartupPath + "\\Classlist.rpt"); bkng.SetDataSource(ds.Tables["classlist"]); PrinterSettings print = new PrinterSettings(); //pass parameters //pass year string strParameter1 = ""; strParameter1 = Convert .ToString (this.dataGridView1.Rows[c].Cells[0].Value); bkng.SetParameterValue("Class", strParameter1); bkng.PrintOptions.PrinterName = print.PrinterName; //break point is at this line bkng.PrintToPrinter(1, false, 0, 0); } Connection.closeconnection
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)