コード例 #1
0
        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");
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 private void button8_Click(object sender, EventArgs e)
 {
     Databasez.Delete();
 }
コード例 #5
0
 private void button4_Click(object sender, EventArgs e)
 {
     Databasez.Delete();
     Databasez.Create();
     MessageBox.Show("Yeni Veritabanı Olusturuldu");
 }