예제 #1
0
        public void Ekle(ArabaCls arabaCls)
        {
            SqlConnection connection = Baglanti();
            SqlCommand    command    = new SqlCommand("Insert into ArabalarMA values (@marka,@model,@fiyat,@aciklama)", connection);

            command.Parameters.AddWithValue("@marka", arabaCls.Marka);
            command.Parameters.AddWithValue("@model", arabaCls.Model);
            command.Parameters.AddWithValue("@fiyat", arabaCls.Fiyat);
            command.Parameters.AddWithValue("@aciklama", arabaCls.Aciklama);
            command.ExecuteNonQuery();
            connection.Close();
        }
예제 #2
0
        public void Update(ArabaCls arabaCls)
        {
            SqlConnection connection = Baglanti();
            SqlCommand    command    = new SqlCommand("Update ArabalarMA set Marka=@marka,Model=@model,Fiyat=@fiyat,Aciklama=@aciklama where Id=@id", connection);

            command.Parameters.AddWithValue("@marka", arabaCls.Marka);
            command.Parameters.AddWithValue("@model", arabaCls.Model);
            command.Parameters.AddWithValue("@fiyat", arabaCls.Fiyat);
            command.Parameters.AddWithValue("@aciklama", arabaCls.Aciklama);
            command.Parameters.AddWithValue("@id", arabaCls.Id);
            command.ExecuteNonQuery();
            connection.Close();
        }
예제 #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            ArabaDalCls arabaDalCls = new ArabaDalCls();
            ArabaCls    arabaCls    = new ArabaCls {
                Id       = Convert.ToInt32(arabaDgw.CurrentRow.Cells[0].Value),
                Marka    = tbxMarkaUpdate.Text,
                Model    = tbxModelUpdate.Text,
                Fiyat    = Convert.ToDecimal(tbxFiyatUpdate.Text),
                Aciklama = tbxAciklamaUpdate.Text
            };

            arabaDalCls.Update(arabaCls);
            arabaDgw.DataSource = arabaDalCls.Listeleme();
            MessageBox.Show("Araç Kaydı Güncellendi.");
            tbxIdUpdate.Clear();
            tbxMarkaUpdate.Clear();
            tbxModelUpdate.Clear();
            tbxFiyatUpdate.Clear();
            tbxAciklamaUpdate.Clear();
        }