-
Notifications
You must be signed in to change notification settings - Fork 0
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
- bool close
- returns
- SQLiteCommand
- SQLite command method
- SQLiteCommand
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).
Please, when using this project for your own, write a comment to say where you got it from :)
That's all I'm asking for.