Exemplo n.º 1
0
        public bool UlkeEkle(Ulke u)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("insert into Ulkeler (UlkeAdi, UlkeTelCod, Aciklama) values (@Adi, @TelCod, @Aciklama)", conn);

            comm.Parameters.Add("@Adi", SqlDbType.VarChar).Value      = u._ulkeAdi;
            comm.Parameters.Add("@TelCod", SqlDbType.VarChar).Value   = u._ulkeTelCode;
            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);
        }
Exemplo n.º 2
0
        public bool UlkeGuncelle(Ulke u)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("update Ulkeler set UlkeAdi=@Adi, UlkeTelCod=@TelCod, aciklama=@Aciklama where ulkeID=@ulkeID", conn);

            comm.Parameters.Add("@Adi", SqlDbType.VarChar).Value      = u._ulkeAdi;
            comm.Parameters.Add("@ulkeID", SqlDbType.Int).Value       = u._ulkeID;
            comm.Parameters.Add("@TelCod", SqlDbType.VarChar).Value   = u._ulkeTelCode;
            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);
        }