示例#1
0
        public SQLite.SQLiteConnection GetConnection()
        {
            var    sqliteFilename = "Dianet.db3";
            string documentsPath  = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder
            var    path           = Path.Combine(documentsPath, sqliteFilename);
            //delete DB
            //File.Delete(path);
            bool dbexist = File.Exists(path);

            var conn = new SQLite.SQLiteConnection(path);

            if (!dbexist)
            {
                StorageManager.CreateDB(conn);
            }
            // Return the database connection
            return(conn);
        }