private void button5_Click(object sender, EventArgs e) { SQLiteConnection m_conn = Databasez.Connect(); m_conn.Open(); string sql = "create table canlilar (name varchar(20), age int, color varchar(20))"; SQLiteCommand command = new SQLiteCommand(sql, m_conn); command.ExecuteNonQuery(); m_conn.Close(); MessageBox.Show("Canlilar isimli yeni Tablo olusturuldu"); }
private void button7_Click(object sender, EventArgs e) { SQLiteConnection m_conn = Databasez.Connect(); m_conn.Open(); string sql = "select * from canlilar order by name desc"; DataSet dataSet = new DataSet(); SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(sql, m_conn); dataAdapter.Fill(dataSet); dataGridView1.DataSource = dataSet.Tables[0].DefaultView; m_conn.Close(); }
private void button6_Click(object sender, EventArgs e) { SQLiteConnection m_conn = Databasez.Connect(); m_conn.Open(); for (int i = 0; i < Kume.canlilistesi.Count(); i++) { string str1 = Kume.canlilistesi[i].Name; string str2 = Convert.ToString(Kume.canlilistesi[i].Age); string str3 = Kume.canlilistesi[i].Color; string sql = "insert into canlilar (name, age,color) values ('" + str1 + "','" + str2 + "','" + str3 + "')"; SQLiteCommand command = new SQLiteCommand(sql, m_conn); command.ExecuteNonQuery(); } MessageBox.Show("Tablo ya -Runtime da-mevcut tum nesneler=>" + Kume.canlilistesi.Count() + " adet nesne eklendi"); m_conn.Close(); }
private void button8_Click(object sender, EventArgs e) { Databasez.Delete(); }
private void button4_Click(object sender, EventArgs e) { Databasez.Delete(); Databasez.Create(); MessageBox.Show("Yeni Veritabanı Olusturuldu"); }