MySQLdb._exceptions.OperationalError:(1054,“未知错误1054”)

2024-05-16 10:18:50 发布

您现在位置:Python中文网/ 问答频道 /正文

1.当我更新时,我得到了这个错误

try:
            cur=db.cursor()
            print("update cur",cur)
            cur.execute('''UPDATE ast_details SET Asset_ID=%s,Make=%s,Model_No=%s,Serial_No=%s,
                    Purchased_Date=%s,Expired_Date=%s,Purchased_From=%s,Vendor_Name=%s,
                    Cost=%s,Laptop_Age=%s,Allocated_User=%s,
                    Allocated_Date=%s,Emp_ID=%s,Return_Date=%s where S.no=%s''',(ast_id,make,m_no,s_no,purch_dte,exp_dte,purch_frm,vndr_nme,cost,lap_age,alloc_usr,alloc_dte,emp_id,rtrn_dte,txtwhere))
        except mdb.MySQLError as e:
            print(e)

Tags: noiddate错误astprinttrycur
1条回答
网友
1楼 · 发布于 2024-05-16 10:18:50
I got solution I chnaged all column names with tild symbol it works fine for me
cur.execute('''UPDATE `ast_details` SET `Asset_ID`=%s,`Make`=%s,`Model_No`=%s,`Serial_No`=%s,
                    `Purchased_Date`=%s,`Expired_Date`=%s,`Purchased_From`=%s,`Vendor_Name`=%s,
                    `Cost`=%s,`Laptop_Age`=%s,`Allocated_User`=%s,
                    `Allocated_Date`=%s,`Emp_ID`=%s,`Return_Date`=%s WHERE `S.no`=%s''',(ast_id,make,m_no,s_no,purch_dte,exp_dte,purch_frm,vndr_nme,cost,lap_age,alloc_usr,alloc_dte,emp_id,rtrn_dte,txtwhere,))

相关问题 更多 >