VB出现'80040E14'update语句的语法错误

来源:百度知道 编辑:UC知道 时间:2024/06/27 21:55:29
Public Sub Update(ByVal TmpComputerNo As String)
'设置UPDATE语句
SqlStmt = "Update Computers Set TypeId=" + Trim(TypeId) _
+ ", ComputerName='" + Trim(ComputerName) _
+ "',SaleId=" + Trim(SaleId) + ",BuyDate='" + Trim(BuyDate) + "'," _
+ "MendNo='" + Trim(MendNo) + "',MendId=" + Trim(MendId) + "," _
+ "MendType='" + Trim(MendType) + "',MendSdate='" + Trim(MendSdate) + "'," _
+ "MendEdate='" + Trim(MendEdate) + "',Deposit=" + Trim(desposit) + "," _
+ "DayPrice=" + Trim(DayPrice) + ",WeekEndPrice=" + Trim(WeekEndPrice) + "," _
+ "WeekPrice=" + Trim(WeekPrice) + "," _
+ "MonthPrice=" + Trim(MonthPrice) + ",&q

可能是因为数据类型不匹配(你是不是用了日期类型字段?),更新日期字段时我给你两个例子,你参考一下。

如果是ACCESS,这样写:
SqlStmt = "Update Computers Set BuyDate=#2001-2-2#"

如果是SQL SERVER,这样写:
SqlStmt = "Update Computers Set BuyDate='2001-2-2'"