public emlakTip emlakTipGetirId(int eTipId) { emlakTip et = new emlakTip(); try { SqlCommand com = new SqlCommand("select * from EmlakTip where EmlakTipId=@etip", con); com.Parameters.AddWithValue("@etip", eTipId); com.CommandType = CommandType.Text; con.Open(); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { et.EmlakTipId = Convert.ToInt32(dr["EmlakTipId"]); et.EmlakTipAd = dr["EmlakTipAd"].ToString(); } dr.Close(); } catch (Exception ex) { } finally { con.Close(); } return(et); }
public List <emlakTip> emlakTipGetirTum() { List <emlakTip> emlakTipler = new List <emlakTip>(); try { SqlCommand com = new SqlCommand("select * from EmlakTip order by EmlakTipAd", con); com.CommandType = CommandType.Text; con.Open(); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { emlakTip et = new emlakTip(); et.EmlakTipId = Convert.ToInt32(dr["EmlakTipId"]); et.EmlakTipAd = dr["EmlakTipAd"].ToString(); emlakTipler.Add(et); } dr.Close(); } catch (Exception ex) { } finally { con.Close(); } return(emlakTipler); }