예제 #1
0
        private void btnSearchPatient_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtPatientID.Text))
            {
                CrystalReportPatientTreatmentHistory cr = new CrystalReportPatientTreatmentHistory();
                SqlConnection conn = new SqlConnection();
                conn = DbConnection.getConnection();

                conn.Open();
                string sql = "select * from patienttreatmenthistory";

                DataSet        ds      = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

                adapter.Fill(ds, "PatientTreatmentHistory");
                DataTable dt = ds.Tables["PatientTreatmentHistory"];

                cr.SetDataSource(ds.Tables["PatientTreatmentHistory"]);
                crystalReportViewer1.ReportSource = cr;
                crystalReportViewer1.Refresh();
                conn.Close();
            }
            else
            {
                CrystalReportPatientTreatmentHistory cr = new CrystalReportPatientTreatmentHistory();
                SqlConnection conn = new SqlConnection();
                conn = DbConnection.getConnection();

                string pid = txtPatientID.Text;

                conn.Open();
                string sql = "select * from patienttreatmenthistory where patientid='" + pid + "'";

                DataSet        ds      = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

                adapter.Fill(ds, "PatientTreatmentHistory");
                DataTable dt = ds.Tables["PatientTreatmentHistory"];

                cr.SetDataSource(ds.Tables["PatientTreatmentHistory"]);
                crystalReportViewer1.ReportSource = cr;
                crystalReportViewer1.Refresh();
                conn.Close();
            }
        }
예제 #2
0
        private void frmPatientTreatmentHistory_Load_1(object sender, EventArgs e)
        {
            this.btnSearchPatient.Image = WindowsFormsApplication1.Properties.Resources.search_icon_16;
            CrystalReportPatientTreatmentHistory cr = new CrystalReportPatientTreatmentHistory();
            SqlConnection conn = new SqlConnection();

            conn = DbConnection.getConnection();

            conn.Open();
            string sql = "select * from patienttreatmenthistory";

            DataSet        ds      = new DataSet();
            SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

            adapter.Fill(ds, "PatientTreatmentHistory");
            DataTable dt = ds.Tables["PatientTreatmentHistory"];

            cr.SetDataSource(ds.Tables["PatientTreatmentHistory"]);
            crystalReportViewer1.ReportSource = cr;
            crystalReportViewer1.Refresh();
            conn.Close();
        }