Exemplo n.º 1
0
        public SQLiteCommand(String commandText, SQLiteConnection connection)
            : this(commandText)
        {
            if (connection == null)	throw new ArgumentNullException("Connection is null.");

            Connection = connection;
        }
Exemplo n.º 2
0
        internal SQLiteTransaction(SQLiteConnection connection)
        {
            _Connection = connection;
            if (_Connection == null) throw new ArgumentNullException("Connection cannot be null.");

            Execute("BEGIN");
        }
Exemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _Connection = new SQLiteConnection("Data Source=test1.db;NewDatabase=True;Synchronous=Off;Encoding=UTF8;Emulator=true");
            _Connection.Open();
            InitializeTables();

            SQLiteCommand cmd = _Connection.CreateCommand();
            cmd.CommandText = "select id, items, customer, amount from orders";

            DataTable table = new DataTable();

            table.Columns.Add("Id");
            table.Columns.Add("Items");
            table.Columns.Add("Customer");
            table.Columns.Add("Amount");

            SQLiteDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                DataRow row = table.NewRow();
                row["Id"] = reader.GetInt32(0);
                row["Items"] = reader.GetInt32(1);
                row["Customer"] = reader.GetString(2);
                row["Amount"] = reader.GetDouble(3);
                table.Rows.Add(row);
            }

            dataGridView1.DataSource = table;
        }
Exemplo n.º 4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     _Connection = new SQLiteConnection("Data Source=\\Program Files\\sqlitetest\\test.db;NewDatabase=True;Synchronous=Off;Encoding=UTF8");
     _Connection.Open();
 }
Exemplo n.º 5
0
 public BelugaDb()
 {
     _Connection = new SQLiteConnection("Data Source=" + DATA_PATH + @"\db\beluga.db;NewDatabase=False;Synchronous=Off;Encoding=UTF8");
 }
Exemplo n.º 6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     _Connection = new SQLiteConnection("Data Source=c:\\data\\redfivelabs\\temp\\SQLiteTest.sqlite;NewDatabase=True;Synchronous=Off;Encoding=UTF8;Emulator=false");
     _Connection.Open();
 }