コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }