-2
ERROR: Could not able to execute INSERT INTO saveanswer (answer) VALUES ('d'). Field 'sanswer' doesn't have a default value如何解決錯誤:無法執行INSERT INTO saveanswer(answer)VALUES('d')。現場「sanswer」沒有默認值
ERROR: Could not able to execute INSERT INTO saveanswer (answer) VALUES ('d'). Field 'sanswer' doesn't have a default value如何解決錯誤:無法執行INSERT INTO saveanswer(answer)VALUES('d')。現場「sanswer」沒有默認值
一種選擇將是這樣的查詢來指定該字段的值:
INSERT INTO saveanswer (answer, sanswer) VALUES ('d', 'something here')
其他的解決方案將是改變你的表格設置該字段的默認值(null或其他)如下:
ALTER TABLE saveanswer ALTER COLUMN sanswer SET DEFAULT null;
將默認值null賦予sanswer列。 –
提供'sanswer'的值將解決您的錯誤。它被聲明爲'not null'(它可能是你的主鍵)而不是自動增量,所以你必須設置該值(或使用自動增量或默認值)。 – Solarflare
可能重複的[mysql錯誤1364字段沒有默認值](http://stackoverflow.com/questions/15438840/mysql-error-1364-field-doesnt-have-a-default-values) –