示例#1
0
        // 다름!!!
        public static void GetPetIDList(CustomerPets CPets)
        {
            string iQuery = string.Format(@"SELECT ID,NAME FROM PET WHERE OWNER_ID={0}", CPets.CustomerID);

            cmdString = new OracleCommand(iQuery, cntString);

            try
            {
                cntString.Open();
                OracleDataAdapter da = new OracleDataAdapter(cmdString);
                DataTable         dt = new DataTable();
                DataSet           ds = new DataSet();
                da.Fill(dt);
                ds.Tables.Add(dt);

                // ID랑 NAME 둘다 있음 (첫번째 칼럼 : ID, 두번째칼럼: NAME)
                // 첫번째 칼럼 (ID) 는 DataValueField에, 두번째 칼럼 (NAME) 은 DataTextField에 넣어준다
                CPets.PetIDs = ds.Tables[0];



                //ids.PetIDs = ds.Tables[0];
            }

            finally
            {
                cntString.Close();
            }
        }
示例#2
0
        // getting petID by selecting customerID
        protected void selectcustomer(object sender, EventArgs e)
        {
            petIDList.Items.Clear();

            Oid = cusIDList.SelectedValue.ToString();

            CustomerPets CPets = new CustomerPets(Oid, pids, pnames);

            try
            {
                ConnectionClass.GetPetIDList(CPets);
                petIDList.DataSource     = CPets.PetIDs;
                petIDList.DataTextField  = CPets.PetIDs.Columns["NAME"].ToString();
                petIDList.DataValueField = CPets.PetIDs.Columns["ID"].ToString();

                // IDs 지만 ID랑 NAME 둘다 있음 (첫번째 칼럼 : ID, 두번째칼럼: NAME)
                // 첫번째 칼럼 (ID) 는 DataValueField에, 두번째 칼럼 (NAME) 은 DataTextField에 넣어준다
                petIDList.DataBind();
            }

            finally
            {
            }
        }