Example #1
0
        public bool FirmaEkle(Firmalar f)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("insert into Firmalar (FirmaAd, Aciklama) values (@Firmad, @Aciklama)", conn);

            comm.Parameters.Add("@Firma", SqlDbType.VarChar).Value    = f._firmaAd;
            comm.Parameters.Add("@Aciklama", SqlDbType.VarChar).Value = f._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);
        }
Example #2
0
        public bool FirmaGuncelle(Firmalar f)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("update Firmalar set FirmaAd=@FirmaAd, Aciklama=@Aciklama where FirmaID=@FirmaID", conn);

            comm.Parameters.Add("@FirmaID", SqlDbType.Int).Value      = f._firmaID;
            comm.Parameters.Add("@FirmaAd", SqlDbType.VarChar).Value  = f._firmaAd;
            comm.Parameters.Add("@Aciklama", SqlDbType.VarChar).Value = f._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);
        }