[操作疑難] SQL Statement

請問有甚麼錯呢?
VS2015 罵我 Syntax error in UPDATE statement.
I use com = New OleDbCommand(.........................., con)
  1. UPDATE Employee SET
  2. [Employee Number] = 1001, Remark = None,
  3. [Chinese Name] = 陳大文, [English Name] = '%Chan Tai Man%',
  4. Gender = M, Marriage = M,
  5. HKIDCardNumber = A123456(0), HKIDSignDate = 1/1/1900,
  6. [HK Premanent Resident] = None,
  7. [Date of Birth] = 1/1/1990, DOB-Y = 1963, DOB-M = 4, DOB-D = 12,
  8. Age = 53.421917808219177, [Tel Number] = 94572355, Address = 新界4020室, Region = NT,
  9. [Employ Date] = 16/7/2008, ED-Y = 2008, ED-M = 10, ED-D = 20, Title = Clerk,
  10. [SC Needed] = No, [SC Number] = None, [SC A Expiry Date] = 1/1/1900, SCA-Y = 1900, SCA-M = 1, SCA-D = 0,
  11. [SC B Expiry Date] = 1/1/1900, SCB-Y = 1900, SCB-M = 1, SCB-D = 0,
  12. [QCS Needed] = No, [QCS Sign Date] = 1/1/1900, QCS-Y = 1900, QCS-M = 1, QCS-D =0,
  13. [SCard Needed] = No, [SCard Number] = None, SCard-Y = 1900, SCard-M = 1, SCard-D = 0,
  14. [ASL Needed] = No, [ASL Expiry Date] = 1/1/1900, AED-Y = 1900, AED-M = 1, AED-D = 0,
  15. [FA Needed] = No, [FA Number] = None, [FA Expiry Date] = 1/1/1900, FA-Y = 1900, FA-M = 1, FA-D = 0,
  16. DPP = No, [A60 Prove] = No, SPPAS = No,
  17. Bank = 滙豐, [Bank Account] = 1234567899876,
  18. Site = MK-HollyWood, [LW Date] = 1/1/1900, [Current Date] = 8/9/2016,
  19. [Employ Type] = Full Time, HKIDCopyPDF = None,
  20. IQCWVSContractCopyPDF = None, SCCopyPDF = None,
  21. FACopyPDF = None, SCardCopyPDF = None
複製代碼

TOP

除錯技巧:
當一步到位不成功時,建議你 SET 後面逐個或分批加上欄位, 睇吓邊部份引致 Syntax error。

TOP

Maybe all string needs quotes?
eg.
[Chinese Name] = '陳大文',
HKIDCardNumber = 'A123456(0)',

TOP

string 冇quote, field名有"-"要咁 [field-name] 唔係 field-name

TOP

第一樣野,update 冇 where clause

TOP

I see this

TOP

第一樣野,update 冇 where clause
look_yau 發表於 2016-9-9 17:43



    冇where clause咪即係全部update,有乜問題?

TOP

第一樣野,update 冇 where clause
look_yau 發表於 2016-9-9 17:43

update一定要有where? 第一次聽

TOP

本帖最後由 X-Engineer 於 2016-9-14 10:42 編輯

https://msdn.microsoft.com/en-us/library/ms171933.aspx

I change the method. But I got another error:
  1.     Private Sub PersonBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles PersonBindingNavigatorSaveItem.Click
  2.         Me.Validate()
  3.         Me.PersonBindingSource.EndEdit()
  4.         Me.TableAdapterManager.UpdateAll(Me.HRDatabaseDataSet)
  5.     End Sub
複製代碼
Update requires a valid UpdateCommand when passed DataRow collection with modified rows.

TOP