Beispiel #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);
        }
Beispiel #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();
            }
        }
Beispiel #3
0
 // Creates an empty database file
 void createNewDatabase()
 {
     SQLiteConnection.CreateFile("MyDatabase.sqlite");
 }