Exemple #1
0
        public ozellikTip ozellikTipGetirId(int ozellikTipId)
        {
            ozellikTip otp = new ozellikTip();

            try
            {
                SqlCommand com = new SqlCommand("select * from OzellikTip where OzellikTipId = @ozlTipId", con);
                com.Parameters.AddWithValue("@ozlTipId", ozellikTipId);
                com.CommandType = CommandType.Text;

                con.Open();
                SqlDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    otp.OzellikTipAd = dr["OzellikTipAd"].ToString();
                    otp.OzellikTipId = Convert.ToInt32(dr["OzellikTipId"]);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                con.Close();
            }
            return(otp);
        }
Exemple #2
0
        public List <ozellikTip> ozellikTipGetirTum()
        {
            List <ozellikTip> ozellikTipler = new List <ozellikTip>();

            try
            {
                SqlCommand com = new SqlCommand("select * from OzellikTip", con);
                com.CommandType = CommandType.Text;

                con.Open();
                SqlDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    ozellikTip otp = new ozellikTip();
                    otp.OzellikTipAd = dr["OzellikTipAd"].ToString();
                    otp.OzellikTipId = Convert.ToInt32(dr["OzellikTipId"]);
                    ozellikTipler.Add(otp);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                con.Close();
            }
            return(ozellikTipler);
        }