void doktorDoldur() { /************KLİNİK TABLOSUNDAKİ VERİLERE GÖRE DROPDOWNLİST NESNESİNİ DOLDURUYORUM*****************/ con.Open(); SqlDataAdapter klinik = new SqlDataAdapter("SELECT ad FROM tbl_doktor_kayit", con); DataSet ds = new DataSet(); klinik.Fill(ds); DDL_Doktor.DataSource = ds; DDL_Doktor.DataTextField = "ad"; DDL_Doktor.DataBind(); con.Close(); }
protected void DDL_Klinik_SelectedIndexChanged(object sender, EventArgs e) { /**************KLİNİK DropDownListinin seçilen item ine göre doktor tablosundaki kliniğe uygun doktoru getiriyorum**********************/ SqlCommand komut = new SqlCommand("SELECT id, ad, soyad, klinik FROM tbl_doktor_kayit WHERE klinik='" + DDL_Klinik.SelectedItem.Value + "'", con); try { con.Open(); SqlDataReader reader = komut.ExecuteReader(); DDL_Doktor.DataSource = reader; DDL_Doktor.DataTextField = "ad"; DDL_Doktor.DataBind(); //verileri Drop Down List e bağladım reader.Close(); } catch { Response.Write("Bir Hata Oluştu"); } con.Close(); }