Example #1
0
        public bool HavalimaniGuncelle(Havalimani h)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("update havalimanlari set havalimaniAdi=@havalimaniAdi, SehirID=@SehirID, aciklama=@Aciklama, Kisaltmasi=@kisaltma where havalimaniID=@havalimaniID", conn);

            comm.Parameters.Add("@havalimaniAdi", SqlDbType.VarChar).Value = h._havalimaniAdi;
            comm.Parameters.Add("@SehirID", SqlDbType.Int).Value           = h._sehirID;
            comm.Parameters.Add("@Aciklama", SqlDbType.VarChar).Value      = h._aciklama;
            comm.Parameters.Add("@kisaltma", SqlDbType.VarChar).Value      = h._kisaltmasi;
            comm.Parameters.Add("@havalimaniID", SqlDbType.Int).Value      = h._havalimaniID;
            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);
        }
Example #2
0
        internal bool HavalimaniEkle(Havalimani h)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("insert into havalimanlari (HavalimaniAdi, SehirID, Aciklama, Kisaltmasi) values (@HavalimaniAdi, @SehirID, @Aciklama, @Kisaltmasi)", conn);

            comm.Parameters.Add("@HavalimaniAdi", SqlDbType.VarChar).Value = h._havalimaniAdi;
            comm.Parameters.Add("@SehirID", SqlDbType.Int).Value           = h._sehirID;
            comm.Parameters.Add("@Aciklama", SqlDbType.VarChar).Value      = h._aciklama;
            comm.Parameters.Add("@Kisaltmasi", SqlDbType.VarChar).Value    = h._kisaltmasi;
            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);
        }