DataAccessLibrary/DataAccess.cs
/// <summary>
/// Initializes the database and creates one if not existing
/// </summary>
Initializes the database and creates one if not existing
Initializes the database and creates one if not existing
public static async void InitializeDatabase()
        {
            await ApplicationData.Current.LocalFolder.CreateFileAsync("database.db", CreationCollisionOption.OpenIfExists);
            string dbpath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "database.db");
            using (SqliteConnection db =
                new SqliteConnection($"Filename={dbpath}"))
            {
                db.Open();
                string tableCommand =
                    "CREATE TABLE IF NOT EXISTS Scores " +
                    "(ID INTEGER NOT NULL UNIQUE, " +
                    "Teamname1 TEXT NOT NULL, " +
                    "Teamname2 TEXT NOT NULL, " +
                    "Teamscore1 INTEGER NOT NULL, " +
                    "Teamscore2 INTEGER NOT NULL, " +
                    "PRIMARY KEY(ID AUTOINCREMENT))";
                SqliteCommand createTable = new SqliteCommand(tableCommand, db);
                createTable.ExecuteReader();
            }
        }
public static async void InitializeDatabase ( ) { await ApplicationData . Current . LocalFolder . CreateFileAsync ( " " , CreationCollisionOption . OpenIfExists ) ; string dbpath = Path . Combine ( ApplicationData . Current . LocalFolder . Path , " " ) ; using ( SqliteConnection db = new SqliteConnection ( $" Filename= { dbpath } " ) ) { db . Open ( ) ; string tableCommand = " " + " " + " " + " " + " " + " " + " " ; SqliteCommand createTable = new SqliteCommand ( tableCommand , db ) ; createTable . ExecuteReader ( ) ; } }
Initializes the database and creates one if not existing
Initializes the database and creates one if not existing