public void KategorileriGetir(ComboBox liste) { SqlConnection conn = new SqlConnection(gnl.connStr); SqlCommand comm = new SqlCommand("Select * from Kategoriler where silindi = 0", conn); if (conn.State == ConnectionState.Closed) conn.Open(); SqlDataReader dr; try { dr = comm.ExecuteReader(); while (dr.Read()) { cKategori k = new cKategori(); k._kategoriNo = Convert.ToInt32(dr["KategoriNo"]); k._kategoriAd = (dr["KategoriAd"]).ToString(); liste.Items.Add(k); //liste.Items.Add(dr["KategoriAd"].ToString()); } dr.Close(); } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } }
private void frmUrunler_Load(object sender, EventArgs e) { this.Top = 0; this.Left = 0; cKategori k = new cKategori(); k.KategorileriGetir(cbKategoriler); cUrun u = new cUrun(); DataBagla(); u.UrunleriGetir(lvUrunler); u.KacinciUrun(0); Konum(); }