將SQL datetime數據類型插入行的語法是什麼? Python中的以下內容僅爲timestamp變量提供了一個NULL值。什麼是INSERT datetime變量的語法INTO VALUES
timestamp = datetime.datetime.today()
print timestamp
query = "INSERT INTO table1 (name, class, time_update) VALUES('ONE','TWO',@timestamp)"
cursor.execute(query)
看到這個問題:http://stackoverflow.com/questions/1947750/does-python-support-mysql-prepared-statements – ean5533
你是否正確地傳入'timestamp'變量? http://stackoverflow.com/questions/902408/how-to-use-variables-in-sql-statement-in-python – JSuar