using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Data.SQLite; using System.Windows.Forms; namespace SmartDeviceProject1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { SQLiteConnection sqlite_conn; SQLiteCommand sqlite_cmd; SQLiteDataReader sqlite_datareader; sqlite_conn = new SQLiteConnection("DataSource=Tsdatabase.db;Version=3;New=True;Compress=True;"); sqlite_conn.Open(); sqlite_cmd = sqlite_conn.CreateCommand(); sqlite_cmd.CommandText = "CREATE TABLE Name (id integer primary key, text varchar(100));"; sqlite_cmd.ExecuteNonQuery(); sqlite_cmd.CommandText = "INSERT INTO Name (id, text) VALUES (1, 'john');"; sqlite_cmd.ExecuteNonQuery(); sqlite_cmd.CommandText = "INSERT INTO Name (id, text) VALUES (2, 'john2');"; sqlite_cmd.ExecuteNonQuery(); sqlite_cmd.CommandText = "SELECT * FROM test"; sqlite_datareader = sqlite_cmd.ExecuteReader(); sqlite_conn.Close(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)