private void Print_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; frmBusFeePaymentReceipt frm = new frmBusFeePaymentReceipt(); rptBusFeePaymentReceipt rpt = new rptBusFeePaymentReceipt(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); TransportationFacility_DBDataSet myDS = new TransportationFacility_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection("Data Source=.\\SqlExpress; Integrated Security=True; AttachDbFilename=|DataDirectory|\\CMS_DB.mdf; User Instance=true;"); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from BusFeePayment,Student,Transportation,BusHolders where Student.scholarNo=BusHolders.ScholarNo and BusFeePayment.ScholarNo=Student.ScholarNo and Transportation.SourceLocation=BusHolders.SourceLocation and FeePaymentID= '" + FeePaymentID.Text + "'"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "BusFeePayment"); myDA.Fill(myDS, "Transportation"); myDA.Fill(myDS, "BusHolders"); 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); } }