将日期时间值插入到正确的列中会产生此错误
Warning (from warnings module):
File "C:\Users\Owner\Desktop\sad pROG\Order.py", line 30
(Order_ID, Cust_ID,Order_Price, Order_Date))
Warning: Out of range value for column 'Order_Date' at row 1
我已将 Order_Date 设置为日期时间
这是插入格式
self.c.execute("插入订单值 (%s, %s, %s,%s)", (Order_ID, Cust_ID,Order_Price, Order_Date))
很确定在插入上述值时最后一个 %s 应该是别的东西....
现在我也尝试在前端使用 wx.DateTime.Now() 方法添加条目
def add_entry(self, event):
"""Add a new entry to the Order_Date ite"""
# start out with blank, generic ItemEntry
date =DateTime.Now()
entry = o.OrderEntry("","",0.0,date)
self.endiag = OrderDetail(self,entry)
self.endiag.ShowModal()
self.ord.add_entry(entry.Order_ID,
entry.Cust_ID,
str(entry.Order_Price),
str(entry.Order_Date) )
aaand 在上面的方法中,我尝试为日期设置一个变量,它使我得到了这个特定的错误堆栈
Warning (from warnings module):
File "C:\Users\Owner\Desktop\sad pROG\Order.py", line 30
(Order_ID, Cust_ID,Order_Price, Order_Date))
Warning: Data truncated for column 'Order_Date' at row 1