public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { RptHostelFeePaymentReport rpt = new RptHostelFeePaymentReport(); rpt.Site = this.Site; return(rpt); }
private void AdmissionNo_SelectedIndexChanged(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; RptHostelFeePaymentReport rpt = new RptHostelFeePaymentReport(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); ERPS_DBDataSet myDS = new ERPS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBcon); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * FROM Student INNER JOIN Hosteler ON Student.AdmissionNo = Hosteler.AdmissionNo INNER JOIN HostelFeePayment ON Student.AdmissionNo = HostelFeePayment.AdmissionNo and hostelfeepayment.admissionNo='" + AdmissionNo.Text + "'order by DateOfPayment"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "HostelFeePayment"); myDA.Fill(myDS, "Hostelinfo"); myDA.Fill(myDS, "Hosteler"); myDA.Fill(myDS, "Student"); rpt.SetDataSource(myDS); crystalReportViewer2.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button5_Click(object sender, EventArgs e) { if (Course.Text == "") { MessageBox.Show("Please select class", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Course.Focus(); return; } if (Branch.Text == "") { MessageBox.Show("Please select Section", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Branch.Focus(); return; } try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; RptHostelFeePaymentReport rpt = new RptHostelFeePaymentReport(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); ERPS_DBDataSet myDS = new ERPS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBcon); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * FROM Student INNER JOIN Hosteler ON Student.AdmissionNo = Hosteler.AdmissionNo INNER JOIN HostelFeePayment ON Student.AdmissionNo = HostelFeePayment.AdmissionNo and DateOfPayment between @date1 and @date2 and Class= '" + Course.Text + "'and Section='" + Branch.Text + "' order by DateOfPayment"; MyCommand.Parameters.Add("@date1", SqlDbType.DateTime, 30, "DateOfPayment").Value = Date_from.Value.Date; MyCommand.Parameters.Add("@date2", SqlDbType.DateTime, 30, "DateOfPayment").Value = Date_to.Value.Date; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "HostelFeePayment"); myDA.Fill(myDS, "Hostelinfo"); myDA.Fill(myDS, "Hosteler"); myDA.Fill(myDS, "Student"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }