public Form3() { InitializeComponent(); veriler(); } OleDbConnection baglan = new OleDbConnection ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=veteriner.accdb"); //SqlConnection baglan = new SqlConnection Source=.;Initial Catalog=veteriner;Integrated Security=True"); ŞİFRE GÜNCELLEME EKRANI GÜNCELLEME DÜĞMESİ CS KOMUTLARI
private void veriler() { listView1.Items.Clear(); baglan.Open(); // SqlCommand komut = new SqlCommand("Select * from kullanici",baglan); // SqlDataReader oku = komut.ExecuteReader(); OleDbCommand komut = new OleDbCommand("Select*from kullanici", baglan); OleDbDataReader oku = komut.ExecuteReader(); while(oku.Read()) { ListViewItem ekle = new ListViewItem(); ekle.Text = oku["id"].ToString(); ekle.SubItems.Add(oku["ad"].ToString()); ekle.SubItems.Add(oku["sifre"].ToString()); listView1.Items.Add(ekle); } baglan.Close(); }
GÜNCELLEME DÜĞMESİ private void button1_Click(object sender, EventArgs e) { int id = 1; baglan.Open(); OleDbCommand komut = new OleDbCommand ("update kullanici set ad='" + textBox1.Text.ToString() + "', sifre='" + textBox2.Text.ToString() + "'where id="+id+"", baglan); //SqlCommand komut=new SqlCommand ("update kullanici set ad='"+textBox1.Text.ToString()+"', sifre='"+textBox2.Text.ToString()+"'where id='"+id+"'",baglan); komut.ExecuteNonQuery(); baglan.Close(); veriler(); }
private void listView1_DoubleClick(object sender, EventArgs e) { int id = int.Parse(listView1.SelectedItems[0].SubItems[0].Text); textBox1.Text = listView1.SelectedItems[0].SubItems[1].Text; textBox2.Text = listView1.SelectedItems[0].SubItems[2].Text; } private void button2_Click(object sender, EventArgs e) { this.Hide(); }