///<summary> /// Sehir Data Select ///</summary> public static SehirCollection GetSelect() { SehirCollection rvSehir = new SehirCollection(); using (MConnection conneciton = new MConnection(MClientProvider.MySQL)) { switch (conneciton.State) { case System.Data.ConnectionState.Closed: conneciton.Open(); break; } using (MCommand cmd = new MCommand(CommandType.Text, "select * from sehir order by adi asc", conneciton)) { using (IDataReader IDR = cmd.ExecuteReader()) { while (IDR.Read()) { rvSehir.Add(new Sehir(MConvert.NullToByte(IDR["id"]), MConvert.NullToString(IDR["adi"]))); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvSehir); }
/// <summary> /// Sehir Liste Getir /// </summary> public static SehirCollection GetList(CommandType cmdType, string sqlQuery, MParameterCollection parameters) { SehirCollection rvSehir = new SehirCollection(); using (MConnection conneciton = new MConnection(MClientProvider.MySQL)) { switch (conneciton.State) { case System.Data.ConnectionState.Closed: conneciton.Open(); break; } using (MCommand cmd = new MCommand(cmdType, sqlQuery, conneciton)) { if (parameters != null) { foreach (MParameter item in parameters) { cmd.Parameters.Add(item); } } using (IDataReader IDR = cmd.ExecuteReader()) { while (IDR.Read()) { rvSehir.Add(new Sehir(MConvert.NullToByte(IDR["id"]), MConvert.NullToString(IDR["adi"]))); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvSehir); }