Example create/open a database and return it ready to be used

import sqlite3

db1 = None
db1cursor = None

def open_my_database():

    global db1
    global db1cursor

    #Open the database (will be created if not already present)
    db1 = sqlite3.connect(C:\\MyFolderName\\MyDatabaseName.db')
    db1cursor = db1.cursor()        #Get the cursor object to access the database

    return
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *