{"id":2237,"date":"2023-05-21T12:04:14","date_gmt":"2023-05-21T09:04:14","guid":{"rendered":"https:\/\/www.aydiner.gen.tr\/?p=2237"},"modified":"2023-05-21T22:05:59","modified_gmt":"2023-05-21T19:05:59","slug":"c-ile-windows-form-veritabani-sil-islemi","status":"publish","type":"post","link":"https:\/\/www.aydiner.gen.tr\/index.php\/2023\/05\/21\/c-ile-windows-form-veritabani-sil-islemi\/","title":{"rendered":"C# ile Windows Form Veritaban\u0131 Sil \u0130\u015flemi"},"content":{"rendered":"<p><a href=\"https:\/\/www.aydiner.gen.tr\/wp-content\/uploads\/2023\/05\/sil.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-thumbnail wp-image-2238\" src=\"https:\/\/www.aydiner.gen.tr\/wp-content\/uploads\/2023\/05\/sil-150x150.jpg\" alt=\"\" width=\"150\" height=\"150\" \/><\/a><\/p>\n<p>Yukar\u0131daki form elemanlar\u0131 forma eklenir.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n public partial class Form1 : Form\r\n    {\r\n\r\n        SqlConnection baglanti = new SqlConnection(&quot;Data Source=ali\\\\SQLEXPRESS; Initial Catalog=Kitaplar; Integrated Security=True;&quot;);\r\n        \/\/Kendi bilgisayar\u0131m\u0131z oldu\u011fundan localhost, Veritaban\u0131 ad\u0131 ve \u015fifresiz ba\u011flat\u0131 yap\u0131ld\u0131\u011f\u0131 belirtildi.\r\n        SqlCommand cmd;\r\n\r\n\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n\r\n\r\n     \r\n\r\n        private void BtnSil_Click(object sender, EventArgs e)\r\n        {\r\n            baglanti.Open();\r\n            cmd = new SqlCommand(&quot;Delete From Kitaplar Where KitapId=&quot; + TxtKitapID.Text, baglanti);\r\n            cmd.ExecuteNonQuery();\r\n            cmd.Dispose();\r\n            baglanti.Close();\r\n            MessageBox.Show(&quot;Kay\u0131t Silindi.&quot;);\r\n            \r\n\r\n        }\r\n\r\n        private void button1_Click(object sender, EventArgs e)\r\n        {\r\n            baglanti.Open();\r\n            \/\/Ba\u011flant\u0131 a\u00e7\u0131l\u0131yor.\r\n\r\n\r\n            cmd = new SqlCommand(&quot;insert into Kitaplar(KitapAdi,Yazar,SayfaSayisi) Values('&quot; + TxtKitapAdi.Text + &quot;','&quot; + TxtYazar.Text + &quot;',&quot; + TxtSayfaSayisi.Text + &quot;)&quot;, baglanti);\r\n            \/\/SqlCommand nesnesi i\u00e7erisinde bir kaydet sorgusu olu\u015fturulur ve alan isimleri do\u011fru bir \u015fekilde girilir\r\n\r\n            cmd.ExecuteNonQuery();\r\n            \/\/SQL sorgusu \u00e7al\u0131\u015ft\u0131r\u0131l\u0131yor.\r\n\r\n            cmd.Dispose();\r\n            \/\/Command yani cmd nesnesi bellekte yer kaplamas\u0131n diye bo\u015falt\u0131l\u0131r.\r\n\r\n            baglanti.Close();\r\n            \/\/Ba\u011flant\u0131 kapat\u0131l\u0131yor.\r\n            MessageBox.Show(&quot;Kay\u0131t Eklendi.&quot;);\r\n        }\r\n    }\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C# ile Windows Form ile Ger\u00e7ekle\u015ftirilen Projelerde Veritaban\u0131 Sil \u0130\u015flemi<\/p>\n","protected":false},"author":1,"featured_media":2233,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,180,6],"tags":[],"class_list":["post-2237","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programlama","category-sql","category-web"],"_links":{"self":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/posts\/2237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/comments?post=2237"}],"version-history":[{"count":1,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/posts\/2237\/revisions"}],"predecessor-version":[{"id":2239,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/posts\/2237\/revisions\/2239"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/media\/2233"}],"wp:attachment":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/media?parent=2237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/categories?post=2237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/tags?post=2237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}