I am trying to submit a form into DB Browser Sqlite. I've created a table. I am able to store the data into Sqlite. However, once I add in a function to execute a cofirmation popup box in submit button (submitclaim.html), I was displayed with this error
sqlite3.OperationalError: database is locked
When I try to submit a form to the table, it occurs on the line:
c.execute("INSERT INTO SubmitClaim VALUES (?,?,?,?,?)", (depart, type, uploadre, amt, description)
This is my app.py
@app.route('/addrec', methods=['POST', 'GET'])
def addrec():
if request.method == 'POST':
depart = request.form['depart']
type = request.form['type']
uploadre = request.form['uploadre']
amt = request.form['amt']
description = request.form['description']
conn = sql.connect(db_path)
c = conn.cursor()
c.execute(
"INSERT INTO SubmitClaim VALUES (?,?,?,?,?)", (depart, type, uploadre, amt, description))
conn.commit()
c.execute("SELECT * FROM SubmitClaim")
print(c.fetchall())
conn.close()
return render_template('base.html', user=session["user"], version=msal.__version__)
This is my SubmitClaim.html
<div class="arrange3">
<button onclick="myFunction()" type="submit" class="submit-button" name="save", value="save">Submit</button>
<script>
function myFunction() {
confirm("Press a button!");
}
You just have to close the Database in DB Browser SQLITE and run the code