Code To UPDATE in access Db using c# // SQL Server Management Studio

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace UPDATE_DY
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
             SqlConnection n = new SqlConnection();
             n.ConnectionString = "Data Source=LENOVO-PC;Initial Catalog=DicleYilmaz;Integrated Security=True";
            n.Open();
           
            SqlCommand d = new SqlCommand();
            d.Connection = n;
           // d.CommandText = "Select * from Personel";
            d.CommandText = "Update URUNLER set URUN_ADI=@URUN_ADI, FIYATI=@FIYATI, ADET=@ADET, OZELLIKLERI=@OZELLIKLERI, KATEGORIID=@KATEGORIID where URUNID=@URUNID";
            d.CommandType = CommandType.Text;
            d.Parameters.AddWithValue("@URUN_ADI", textBox1.Text);
            d.Parameters.AddWithValue("@FIYATI", textBox2.Text);
            d.Parameters.AddWithValue("@ADET", textBox3.Text);
            d.Parameters.AddWithValue("@OZELLIKLERI", textBox4.Text);
            d.Parameters.AddWithValue("@KATEGORIID", textBox5.Text);
            d.Parameters.AddWithValue("@URUNID", textBox6.Text);
            d.ExecuteNonQuery();

         
     
       
        }
    }
}

Yorumlar

Popüler Yayınlar