fatih29 Posted June 27, 2020 Share Posted June 27, 2020 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.OleDb; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=kisiler.accdb"); DataTable dt = new DataTable(); OleDbDataAdapter adapter = new OleDbDataAdapter(); private void Form1_Load(object sender, EventArgs e) { listView1.FullRowSelect = true; listView1.Columns.Add("ID"); listView1.Columns.Add("Ad"); listView1.Columns.Add("Soyad"); listView1.Columns.Add("Numara"); baglanti.Open(); OleDbCommand komut = new OleDbCommand("SELECT * FROM kisiler", baglanti); OleDbDataReader okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { int count = listView1.Items.Count; listView1.Items.Add(okuyucu["id"].ToString()); listView1.Items[count].SubItems.Add(okuyucu["ad"].ToString()); listView1.Items[count].SubItems.Add(okuyucu["soyad"].ToString()); listView1.Items[count].SubItems.Add(okuyucu["numara"].ToString()); } baglanti.Close(); } private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Trim() != "" && textBox2.Text.Trim() != "" && textBox3.Text.Trim() != "") { baglanti.Open(); OleDbCommand komut = new OleDbCommand("INSERT INTO kisiler (ad, soyad, numara) VALUES ('"+textBox1.Text.Trim()+"', '"+textBox2.Text.Trim()+"', @numara)", baglanti); komut.Parameters.AddWithValue("@numara", int.Parse(textBox3.Text.Trim())); komut.ExecuteNonQuery(); komut.Dispose(); baglanti.Close(); } } private void button2_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { baglanti.Open(); foreach (ListViewItem item in listView1.SelectedItems) { int id = int.Parse(item.Text); OleDbCommand komut = new OleDbCommand("DELETE FROM kisiler WHERE id=@id", baglanti); komut.Parameters.AddWithValue("@id", id); komut.ExecuteNonQuery(); komut.Dispose(); } baglanti.Close(); } } private void button3_Click(object sender, EventArgs e) { } private void button3_Click_1(object sender, EventArgs e) { baglanti.Open();//Sorun burda if (textBox4.Text.Trim() != "") { int id = int.Parse(textBox4.Text); string ad = textBox5.Text.Trim(); string soyad = textBox6.Text.Trim(); string numara = textBox7.Text.Trim(); if (ad != "" && soyad != "" && numara != "") { OleDbCommand komut = new OleDbCommand("UPDATE kisiler SET ad='" + ad + "', soyad='" + soyad + "', numara='" + numara + "' WHERE id=@id", baglanti); komut.Parameters.AddWithValue("@id", id); komut.ExecuteNonQuery(); komut.Dispose(); baglanti.Close(); } } } private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 1) { string id = listView1.Items[listView1.SelectedItems[0].Index].Text; string ad = listView1.Items[listView1.SelectedItems[0].Index].SubItems[1].Text; string soyad = listView1.Items[listView1.SelectedItems[0].Index].SubItems[2].Text; string numara = listView1.Items[listView1.SelectedItems[0].Index].SubItems[3].Text; textBox4.Text = id; textBox5.Text = ad; textBox6.Text = soyad; textBox7.Text = numara; } } private void label8_Click(object sender, EventArgs e) { } private void label7_Click(object sender, EventArgs e) { } private void button4_Click(object sender, EventArgs e) { listView1.Items.Clear(); listView1.Columns.Clear(); listView1.Columns.Add("ID"); listView1.Columns.Add("Ad"); listView1.Columns.Add("Soyad"); listView1.Columns.Add("Numara"); baglanti.Open(); OleDbCommand komut = new OleDbCommand("SELECT * FROM kisiler ORDER BY ad DESC", baglanti); OleDbDataReader okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { int count = listView1.Items.Count; listView1.Items.Add(okuyucu["id"].ToString()); listView1.Items[count].SubItems.Add(okuyucu["ad"].ToString()); listView1.Items[count].SubItems.Add(okuyucu["soyad"].ToString()); listView1.Items[count].SubItems.Add(okuyucu["numara"].ToString()); } baglanti.Close(); } private void textBox8_TextChanged(object sender, EventArgs e) { listView1.Items.Clear(); baglanti.Open(); OleDbCommand komut = new OleDbCommand("SELECT * FROM kisiler WHERE ad LIKE '%" + textBox8.Text.Trim() + "%'", baglanti); OleDbDataReader okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { int count = listView1.Items.Count; listView1.Items.Add(okuyucu["id"].ToString()); listView1.Items[count].SubItems.Add(okuyucu["ad"].ToString()); listView1.Items[count].SubItems.Add(okuyucu["soyad"].ToString()); listView1.Items[count].SubItems.Add(okuyucu["numara"].ToString()); } baglanti.Close(); } } } // yada ben projeyi x64 yapamadım özelliklerden visual studio 2019 kullanıyorum yeniyim OleDbVeritabaniOrnek.rar Quote Link to comment Share on other sites More sharing options...
KiNGHaZe Posted June 27, 2020 Share Posted June 27, 2020 Merhaba, "Proje" > en alta inip proje ismi özellikleri > derleme > platform hedefi > x64 seçip kaydet. Quote Link to comment Share on other sites More sharing options...
fatih29 Posted June 27, 2020 Author Share Posted June 27, 2020 Dediğini yaptım olmadı Please register to see this content. Quote Link to comment Share on other sites More sharing options...
KiNGHaZe Posted June 27, 2020 Share Posted June 27, 2020 Debug klasöründen çıkan dosyaları al x86 pcde açmayı dene. Açılmaz, x64 hatası verir. Quote Link to comment Share on other sites More sharing options...
fatih29 Posted June 27, 2020 Author Share Posted June 27, 2020 (edited) Peki nasıl yapayım Edited June 27, 2020 by fatih29 Quote Link to comment Share on other sites More sharing options...
KiNGHaZe Posted June 27, 2020 Share Posted June 27, 2020 fatih29, 3 dakika önce yazdı: Peki nasıl yapayım Projen dediğmi ayarları yaptıktan sonra artık x64 şekilde derleniyor. Sıkıntı çıkmaz devam et projene Quote Link to comment Share on other sites More sharing options...
fatih29 Posted June 28, 2020 Author Share Posted June 28, 2020 (edited) Please register to see this content. x64 ayrı hata-----X86 ayrı hata---anyCPU x86 aynı anlamadım Sorunu Çözdüm Teşekkürler..senyor3 Edited June 28, 2020 by fatih29 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.