【发布时间】:2020-06-30 09:05:51
【问题描述】:
我需要将以下值替换为选择查询。但我得到了下面提到的错误
def addSoil(self):
name = self.ent_name.get()
texture = self.ent_texture.get()
colour = self.ent_colour.get()
capacity = self.ent_capacity.get()
equation = self.ent_equation.get()
try:
con = cx_Oracle.connect('hr/hr@192.168.56.1/xepdb1')
cursor = con.cursor()
cursor.execute('INSERT INTO soildata (soil_name, soil_text, soil_colour, soil_waterhold, soil_chemicalequ) '
'VALUES(%s,%s,%s,%s,%s)', (name,texture,colour,capacity,equation))
con.commit()
except cx_Oracle.DatabaseError as e:
print("There is a problem with Oracle", e)
finally:
if cursor:
cursor.close()
if con:
con.close()
【问题讨论】:
-
您的
self.ent_*.中存储了哪些类型?检查soil_name, soil_text, soil_colour, soil_waterhold, soil_chemicalequ的名称 -
尝试将五个占位符
%s更改为:1,:2,:3,:4,:5。
标签: python-3.x tkinter pycharm cx-oracle oracle18c