Esempio n. 1
0
        protected bool CreateDB(string Query)
        {
            if (!File.Exists(dbFileName))
            {
                SQLiteConnection.CreateFile(dbFileName);
            }

            try
            {
                Connection = new SQLiteConnection("Data Source=" + dbFileName + ";Version=3;");
                Connection.Open();
                Command.Connection = Connection;

                Command.CommandText = Query;
                Command.ExecuteNonQuery();
            }
            catch (SQLiteException ex)
            {
                ErrorMsg = ex.Message;
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        private void fnRecreate()
        {
            if (DB != null)
            {
                DB.Close(); DB.Dispose();
            }
            if (System.IO.File.Exists(tDB.Text + ".db"))
            {
                System.IO.File.Delete(tDB.Text + ".db");
            }
            SQLiteConnection.CreateFile(tDB.Text + ".db");
            SQLiteConnection.CompressFile(tDB.Text + ".db");
            DB = new SQLiteConnection("Data source=" + tDB.Text + ".db");
            DB.Open();

            using (SQLiteCommand DBc = DB.CreateCommand())
            {
                DBc.CommandText = "CREATE TABLE 'dickbutt' (" +
                                  "'id' unsigned bigint(20), " +
                                  "'hash' varchar(32), " +
                                  "'tags' text)";
                DBc.ExecuteNonQuery();
            }
        }
Esempio n. 3
0
 // Creates an empty database file
 void createNewDatabase()
 {
     SQLiteConnection.CreateFile("MyDatabase.sqlite");
 }