public void Read(string addgroup, string sy) { SqlConnection conn = new SqlConnection(this.connectionString); SqlCommand comm = new SqlCommand("dbo.UspSalarySheetMonthReport", conn); comm.CommandType = CommandType.StoredProcedure; comm.Parameters.Add("@Salary_Month", SqlDbType.VarChar,20); comm.Parameters["@Salary_Month"].Value = comboBox4.Text; comm.Parameters.Add("@Salary_Year", SqlDbType.VarChar, 10); comm.Parameters["@Salary_Year"].Value = comboBox1.Text; SqlDataAdapter adap = new SqlDataAdapter(); DatabaseDataSet dataset = new DatabaseDataSet(); SalarySheetMonthlyCrystalReport1 crp = new SalarySheetMonthlyCrystalReport1(); try { conn.Open(); adap.SelectCommand = comm; adap.Fill(dataset, "DataTable1"); crp.SetDataSource(dataset); crystalReportViewer2.ReportSource = crp; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { conn.Close(); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { SalarySheetMonthlyCrystalReport1 rpt = new SalarySheetMonthlyCrystalReport1(); rpt.Site = this.Site; return rpt; }