Quantcast
Channel: C#nedir?com Forum
Viewing all articles
Browse latest Browse all 613

Visual C# : Gridviewde Seçilen Satır MySql Update

$
0
0
Author: zafercelebi
Subject: Gridviewde Seçilen Satır MySql Update
Posted: 21 Aralık 2017 at 17:03

Merhaba ,

Gridviewde seçtiğim tek satırı MySqlDatabase de update ediyorum. Aşağıdaki kod ile. 
Yapmak istediğim şey birden fazla seçtiğimde her seçileni update etmek ve gerekirse tüm gridviewdeki kayıtları update etmek Yardımcı olabilirmisiniz.


string model = gw_urunler.CurrentRow.Cells["UrunKodu"].Value.ToString();
                int adet = Convert.ToInt32(gw_logo_urunler.CurrentRow.Cells["StokAdedi"].Value.ToString());
                decimal Fiyat = Convert.ToDecimal(gw_logo_urunler.CurrentRow.Cells["SatisFiyati"].Value.ToString());
                string updateQuery = "UPDATE product SET quantity = " + adet + ", price = " + Fiyat.ToString("#.####").Replace(',', '.') + " WHERE model ='" + model.ToString() + "'";

                string MyConnection2 = "str";
                MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);
                MySqlCommand MyCommand2 = new MySqlCommand(updateQuery, MyConn2);
                MySqlDataReader MyReader2;
                MyConn2.Open();
                MyReader2 = MyCommand2.ExecuteReader();

Viewing all articles
Browse latest Browse all 613

Trending Articles