亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

(1064,“您的SQL語法有錯誤; ..在第1行使用正確的語法以在'%s,%s,%s,%s,%s)

(1064,“您的SQL語法有錯誤; ..在第1行使用正確的語法以在'%s,%s,%s,%s,%s)

慕的地6264312 2021-06-01 15:17:24
我正在嘗試將數據插入到我的 mysql 數據庫中,但我總是得到一個錯誤,即參數有問題,我想將其添加到我的插入語句中,我嘗試了各種解決方案以及帶有 ' s','s'工作正常,它已插入我的數據庫中。有沒有人知道什么是錯的?謝謝。try:    conn = mysql.connect()    cursor = conn.cursor()    insert_cmd = "INSERT INTO TBTAB VALUES(%s, %s, %s, %s, %s)"    #insert_cmd = "INSERT INTO TBTAB VALUES('s', 's', 's', 's', 's')"    # insert_cmd = "INSERT INTO TBTAB VALUES(?, ?, ?, ?, ?)"    tpa= ("szilva", "barack", "meggye", "alma", "korte")    #cursor.execute("INSERT INTO TBTAB (UserName, Email, TextBoxCont, NodeChosen, CurDate) VALUES ('Caal', 'TomErichsen', 'Svanger', '400esd6', 'Nqdwasorway');")    cursor.execute(insert_cmd.format(tpa))    conn.commit()    return render_template('form.html')except Exception as e:    return str(e)錯誤:(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s, %s, %s, %s, %s)' at line 1")
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 236 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號