public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptHostelerFeePayment rpt = new rptHostelerFeePayment(); rpt.Site = this.Site; return(rpt); }
private void Print_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; frmHostelFeeReceipt frm = new frmHostelFeeReceipt(); rptHostelerFeePayment rpt = new rptHostelerFeePayment(); //The report you created. NpgsqlConnection myConnection = default(NpgsqlConnection); NpgsqlCommand MyCommand = new NpgsqlCommand(); NpgsqlDataAdapter myDA = new NpgsqlDataAdapter(); // ERPS_DBDataSet myDS = new ERPS_DBDataSet(); //The DataSet you created. //myConnection = new NpgsqlConnection(SQLCONN.DBcon); //MyCommand.Connection = myConnection; //MyCommand.CommandText = "select * from HostelFeePayment,Student,Hostelinfo,Hosteler where Student.AdmissionNo=Hosteler.AdmissionNo and HostelFeePayment.AdmissionNo=Student.AdmissionNo and Hostelinfo.HostelName=Hosteler.Hostelname and HFeePaymentID= '" + FeePaymentID.Text + "'"; //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); //frm.crystalReportViewer1.ReportSource = rpt; //frm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }