コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (connect)
            {
                SqlCommand command = new SqlCommand("Select BloodTypeName, BloodTypeID from BloodType", connect);
                connect.Open();
                bloodT.DataTextField  = "BloodTypeName";
                bloodT.DataValueField = "BloodTypeID";
                bloodT.DataSource     = command.ExecuteReader();
                bloodT.DataBind();
                connect.Close();

                SqlCommand command1 = new SqlCommand("Select TestName, BloodTestID from BloodTestType", connect);
                connect.Open();
                bloodTest.DataTextField  = "TestName";
                bloodTest.DataValueField = "BloodTestID";
                bloodTest.DataSource     = command1.ExecuteReader();
                bloodTest.DataBind();
                connect.Close();

                SqlCommand command2 = new SqlCommand("Select DiagnosisName, DiagnosisID from DiagnosisType", connect);
                connect.Open();
                Diag.DataTextField  = "DiagnosisName";
                Diag.DataValueField = "DiagnosisID";
                Diag.DataSource     = command2.ExecuteReader();
                Diag.DataBind();
                connect.Close();
            }
        }