Пример #1
0
        public bool UcakModelGuncelle(UcakModel u)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("update Modeller set ModelAdi=@Adi, EkoKoltukAdeti=@Eko, BusinessKoltukAdeti=@Buss, FirstKoltukAdeti=@First, Aciklama=@Aciklama where ModelID=@ID", conn);

            comm.Parameters.Add("@Adi", SqlDbType.VarChar).Value      = u._modelAdi;
            comm.Parameters.Add("@Eko", SqlDbType.Int).Value          = u._ekoKoltukAdeti;
            comm.Parameters.Add("@Buss", SqlDbType.Int).Value         = u._businessKoltukAdeti;
            comm.Parameters.Add("@First", SqlDbType.Int).Value        = u._firstKoltukAdeti;
            comm.Parameters.Add("@Aciklama", SqlDbType.VarChar).Value = u._aciklama;
            comm.Parameters.Add("@ID", SqlDbType.Int).Value           = u._modelID;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                Sonuc = Convert.ToBoolean(comm.ExecuteNonQuery());
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
            return(Sonuc);
        }
Пример #2
0
        public bool UcakModelEkle(UcakModel u)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("insert into modeller (ModelAdi, EkoKoltukAdeti,BusinessKoltukAdeti,FirstKoltukAdeti, aciklama) values (@ModelAdi, @EkoKoltukAdeti, @BusinessKoltukAdeti, @FirstKoltukAdeti, @aciklama)", conn);

            comm.Parameters.Add("@ModelAdi", SqlDbType.VarChar).Value        = u._modelAdi;
            comm.Parameters.Add("@EkoKoltukAdeti", SqlDbType.Int).Value      = u._ekoKoltukAdeti;
            comm.Parameters.Add("@BusinessKoltukAdeti", SqlDbType.Int).Value = u._businessKoltukAdeti;
            comm.Parameters.Add("@FirstKoltukAdeti", SqlDbType.Int).Value    = u._firstKoltukAdeti;
            comm.Parameters.Add("@aciklama", SqlDbType.VarChar).Value        = u._aciklama;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                Sonuc = Convert.ToBoolean(comm.ExecuteNonQuery());
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
            return(Sonuc);
        }