Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

python 3.x - sqlite3 error: You did not supply a value for binding 1

def save():
    global editor
    conn = sqlite3.connect('address_book.db')

    c = conn.cursor()

    recordID = delete_box.get()

    c.execute("""UPDATE addresses SET
                first_name=:first,
                last_name=:last,
                address=:address,
                city=:city,
                state=:state,
                zipcode=:zipcode

                WHERE oid=:oid""",
                {
                'oid': int(recordID),
                'first:': ef_name.get(),
                'last': el_name.get(),
                'address': eaddress.get(),
                'city': ecity.get(),
                'state': estate.get(),
                'zipcode': ezipcode.get()})

    conn.commit()
    conn.close()
    editor.destroy()

File "C:/Users/Luke/PycharmProjects/GUI/database.py", line 23, in save c.execute("""UPDATE addresses SET sqlite3.ProgrammingError: You did not supply a value for binding 1.

Can anybody see what is causing this error? I'm sure that I didn't make a typo anywhere and am very confused what could be the root of this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The error is due to the extra colon. Replace

'first:': ef_name.get(), 

with

'first': ef_name.get(),

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...