Skip to content

Method ConnectToDatabase

Louis Richard edited this page Nov 22, 2019 · 1 revision

Open and close the connection to the SQLite database

  • Parameter
    • bool close
      • If false, open database connection
      • If true, close database connection
  • returns
    • SQLiteCommand
      • SQLite command method

First, we check if the local database already exist.
If it doesn't, we create it. We then define conn to be a SQLite connection with the database file.
Then, we define cmd as a SQLite command type from conn.
We then check if we should open or close the connection.
If we have to open the connection, we use conn.Open() to establish a database connection and, then, return cmd.
If we have to close it, we use conn.Close() after defining cmd to null. We then return cmd (null).

Clone this wiki locally