数据库browser.sqlite.operationalerror:数据库已锁定

cunj1qz1  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(200)

我试图提交一个表格到数据库浏览器sqlite。我已经创建了一个表。我能够将数据存储到sqlite中。但是,一旦我在submit按钮(submitclaim.html)中添加了一个函数来执行一个协同验证弹出框,我就会显示这个错误

sqlite3.OperationalError: database is locked

当我尝试向表提交表单时,它出现在以下行:

c.execute("INSERT INTO SubmitClaim VALUES (?,?,?,?,?)", (depart, type, uploadre, amt, description)

这是我的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__)

这是我的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!");
    }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题