0
我想插入。這是我的代碼:Web2Py插入數據庫錯誤
db.define_table('orders',
Field('idProduct', type = 'integer'),
Field('quantity', type = 'integer'),
Field('idUser', type = 'integer'),
Field('status'),
Field('order_date'),
Field('product_price', type = 'integer'))
的SQL:
sql = "Insert into orders (idProduct,idUser,quantity,status,order_date,product_price) values "
sql = sql + "(" + str(idProduct) + "," + str(idUser) + "," + str(quantity) + ",'cart','" + str(order_date)+ "," + str(product_price)+"')"
和我收到以下錯誤:
<class 'sqlite3.OperationalError'> 5 values for 6 columns
我不明白什麼是錯的,因爲如果我刪除product_price
,一切都在工作。
謝謝。
謝謝,我做了同樣的事情之前,但我的代碼被破壞somewere,它仍然無法正常工作。 –
還是一樣的錯誤還是其他? – CodeFuller
另一個錯誤:無法識別的令牌:「'16 -5-2016 11:30,無)」 –