private void cmbPaymentID_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                Cursor         = Cursors.WaitCursor;
                timer1.Enabled = true;
                rptSalarySlip rpt = new rptSalarySlip();
                //The report you created.
                SqlConnection           myConnection = default(SqlConnection);
                SqlCommand              MyCommand    = new SqlCommand();
                SqlDataAdapter          myDA         = new SqlDataAdapter();
                EmployeePayment_DataSet myDS         = new EmployeePayment_DataSet();
                //The DataSet you created.


                myConnection          = new SqlConnection("Data Source=GHAFFARI\\ALIGHAFFARI;Initial Catalog=CMS;Integrated Security=True;");
                MyCommand.Connection  = myConnection;
                MyCommand.CommandText = "select * from Employeepayment where PaymentID= '" + cmbPaymentID.Text + "'";

                MyCommand.CommandType = CommandType.Text;
                myDA.SelectCommand    = MyCommand;
                myDA.Fill(myDS, "EmployeePayment");
                rpt.SetDataSource(myDS);
                crystalReportViewer1.ReportSource = rpt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void FrmSalarySlip_Load(object sender, EventArgs e)
        {
            try
            {
                rptSalarySlip rpt = new rptSalarySlip();
                //The report you created.
                SqlConnection           myConnection = default(SqlConnection);
                SqlCommand              MyCommand    = new SqlCommand();
                SqlDataAdapter          myDA         = new SqlDataAdapter();
                EmployeePayment_DataSet myDS         = new EmployeePayment_DataSet();
                //The DataSet you created.
                frmSalaryPayment frm = new frmSalaryPayment();

                myConnection          = new SqlConnection("Data Source=GHAFFARI\\ALIGHAFFARI;Initial Catalog=CMS;Integrated Security=True;");
                MyCommand.Connection  = myConnection;
                MyCommand.CommandText = "select * from EmployeePayment";

                MyCommand.CommandType = CommandType.Text;
                myDA.SelectCommand    = MyCommand;
                myDA.Fill(myDS, "EmployeePayment");
                rpt.SetDataSource(myDS);
                crystalReportViewer1.ReportSource = rpt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }