// ORM KAVRAMI ILE ILGILI BIR KONU // VERITABAINDAKİ TABLODAN EV LISTESI OLUŞTURULUYOR public static Ev_Tipi[] Evleri_Bul() { List <Ev_Tipi> ev_listesi = new List <Ev_Tipi>(); SQLiteConnection connection = KOD_SINIFI.BaglantiOlustur(); connection.Open(); SQLiteCommand command = connection.CreateCommand(); command.CommandText = "select * from tblEV"; command.ExecuteNonQuery(); SQLiteDataReader data_reader = command.ExecuteReader(); while (data_reader.Read()) { Ev_Tipi ev = new Ev_Tipi(); ev.evAciklama = data_reader["evAciklama"].ToString(); ev.evAlan = Convert.ToInt32(data_reader["evAlan"]); ev.evBinaYasi = Convert.ToInt32(data_reader["evBinaYasi"]); ev.evBulKat = Convert.ToInt32(data_reader["evBulKat"]); ev.evEmlakTip = data_reader["evEmlakTip"].ToString(); ev.evFiyat = Convert.ToInt32(data_reader["evFiyat"]); ev.evID = Convert.ToInt32(data_reader["evID"]); ev.evIL = data_reader["evIL"].ToString(); ev_listesi.Add(ev); } connection.Close(); return(ev_listesi.ToArray()); }
// ORM KAVRAMI ILE ILGILI BIR KONU // VERITABAINDAKİ TABLODAN RESIM LISTESI OLUŞTURULUYOR public static Resim_Tipi[] Veritabanindaki_Butun_Resimleri_Bul() { List <Resim_Tipi> resim_listesi = new List <Resim_Tipi>(); SQLiteConnection connection = KOD_SINIFI.BaglantiOlustur(); connection.Open(); SQLiteCommand command = connection.CreateCommand(); command.CommandText = "select * from tblRESIM"; command.ExecuteNonQuery(); SQLiteDataReader data_reader = command.ExecuteReader(); while (data_reader.Read()) { Resim_Tipi resim = new Resim_Tipi(); resim.resimEvID = Convert.ToInt32(data_reader["resimEvID"]); resim.resimID = Convert.ToInt32(data_reader["resimID"]); resim.resimYol = data_reader["resimYol"].ToString(); resim_listesi.Add(resim); } connection.Close(); return(resim_listesi.ToArray()); }
// VERITABANINDA SORGU ÇALIŞTIRMAK İÇİN KULLANILAN METHOD public static int SorguCalistir(string sorgu) { try { SQLiteConnection connection = KOD_SINIFI.BaglantiOlustur(); connection.Open(); SQLiteCommand command = connection.CreateCommand(); command.CommandText = sorgu; command.ExecuteNonQuery(); return(1); } catch { return(0); } }