WebProje.admin.DB.kapat C# (CSharp) Method

kapat() public method

public kapat ( ) : void
return void
        public void kapat()
        {
            try
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            catch (Exception ex)
            {

                //MessageBox.Show("DB Kapatma Sorunu " + ex);
            }
        }

Usage Example

        protected void btnDuzenle_Click(object sender, EventArgs e)
        {
            DB db = new DB();
            string baslik = txtBaslik.Text;
            string resim = txtResimAdi.Text;
            string aciklama = txtAciklama.Text;
            //string tarih = txtTarih.Text;
            HttpPostedFile yukleDosya = fluDosya.PostedFile;
            if (yukleDosya != null)
            {
                FileInfo dosyaBilgi = new FileInfo(yukleDosya.FileName);
                string path = "../resimler/";
                if (resim != dosyaBilgi.Name)
                {
                    string yukleYer = Server.MapPath(path + dosyaBilgi.Name);
                    fluDosya.SaveAs(yukleYer);
                    resim = dosyaBilgi.Name;
                }
            }
            SqlCommand cm = new SqlCommand("update yerlesimDuzenle set baslik= '" + baslik + "', resimYol= '" + resim + "', aciklama= '" + aciklama + "', tarih= getdate() where yerlesimID= '" + yID + "' ", db.conn);
            db.ac();
            int sonuc = cm.ExecuteNonQuery();
            if (sonuc > 0)
            {
                Response.Redirect("yerlesimDuzenle.aspx");
            }

            db.kapat();
        }
All Usage Examples Of WebProje.admin.DB::kapat