Exemplo n.º 1
0
        public bool UcakGuncelle(Ucak u)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("update Ucaklar set UcakAdi=@UcakAdi, HavayollariID=@HavayollariID, aciklama=@Aciklama, ModelID=@ModelID where UcakID=@UcakID", conn);

            comm.Parameters.Add("@UcakAdi", SqlDbType.VarChar).Value   = u._ucakAdi;
            comm.Parameters.Add("@HavayollariID", SqlDbType.Int).Value = u._havayollariID;
            comm.Parameters.Add("@Aciklama", SqlDbType.VarChar).Value  = u._aciklama;
            comm.Parameters.Add("@ModelID", SqlDbType.Int).Value       = u._modelID;
            comm.Parameters.Add("@UcakID", SqlDbType.Int).Value        = u._ucakID;
            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);
        }
Exemplo n.º 2
0
        public bool UcakEkle(Ucak u)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("insert into Ucaklar (UcakAdi, HavayollariID, ModelID, Aciklama) values (@UcakAdi, @HavayollariID, @ModelID, @Acikalama)", conn);

            comm.Parameters.Add("@UcakAdi", SqlDbType.VarChar).Value   = u._ucakAdi;
            comm.Parameters.Add("@HavayollariID", SqlDbType.Int).Value = u._havayollariID;
            comm.Parameters.Add("@ModelID", SqlDbType.Int).Value       = u._modelID;
            comm.Parameters.Add("@Acikalama", 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);
        }