public List <Ogrenci> VeriGetirme() { List <Ogrenci> result = new List <Ogrenci>(); con.Open(); cmd = new SqlCommand("SELECT * FROM ogrenci", con); dr = cmd.ExecuteReader(); while (dr.Read()) { Ogrenci ogrenci = new Ogrenci() { id = dr[0], ad = dr[1], soyad = dr[2], mail = dr[3], }; result.Add(ogrenci); } con.Close(); dr.Close(); cmd.Dispose(); return(result); }