public static DovizCollection GetSelect() { DovizCollection rvDoviz = new DovizCollection(); using (MConnection conneciton = new MConnection(MClientProvider.OleDb, Commons.ConnectionStringName)) { switch (conneciton.State) { case System.Data.ConnectionState.Closed: conneciton.Open(); break; } using (MCommand cmd = new MCommand(CommandType.Text, "select * from Doviz", conneciton)) { using (IDataReader IDR = cmd.ExecuteReader()) { while (IDR.Read()) { rvDoviz.Add(new Doviz(MConvert.NullToInt(IDR["ID"]), MConvert.NullToString(IDR["Cinsi"]), MConvert.NullToFloat(IDR["Kuru"]), MConvert.NullToDateTime(IDR["Tarih"]))); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvDoviz); }
public void GetData() { try { DovizCollection dc = DovizMethods.GetSelect(); foreach (Doviz d in dc) { if (this.kur1CodeLabel.Text.Equals(d.Cinsi)) { this.kur1CalcEdit.Tag = d; this.kur1CalcEdit.Value = (decimal)d.Kuru; } else if (this.kur2CodeLabel.Text.Equals(d.Cinsi)) { this.kur2CalcEdit.Tag = d; this.kur2CalcEdit.Value = (decimal)d.Kuru; } } } catch (Exception ex) { Commons.Status(Commons.GetErrorCode("FDV", 1) + ex.Message); } }