这是我的SQL语句:
query = "Update(tbl_shifts) SET StartTime=" & starttime & ", Endtime =" & endtime & ", TotalHours =" & totalhours & ", TotalPay=" & pay & ", Completed =" & True & "WHERE ShiftDate=" & DateTime.Today And "EmployeeName =" & EmployeeLogin.usersname
点击按钮后,应该添加变量(starttime,endtime,totalhours,pay)并勾选yes / no' Completed
'在tbl_shifts
行中的字段,其中“EmployeeName
'”列中的条目匹配全局变量' EmployeeLogin.usersname
'并且列ShiftDate
中的条目(当前存储为DD/MM/YYYY HH:MM:SS
)与DateTime.Today
匹配(仅DD/MM/YYYY
(我认为))。我该怎么做才能让我的SQL按预期工作?
答案 0 :(得分:0)
您的查询中有一些拼写错误
此:
query = "Update(tbl_shifts) SET StartTime=" & starttime & ", Endtime =" & endtime & ", TotalHours =" & totalhours & ", TotalPay=" & pay & ", Completed =" & True & "WHERE ShiftDate=" & DateTime.Today And "EmployeeName =" & EmployeeLogin.usersname
应该是:
query = "Update tbl_shifts SET StartTime=" & starttime & ", Endtime =" & endtime & ", TotalHours =" & totalhours & ", TotalPay=" & pay & ", Completed =" & True & " WHERE ShiftDate=" & DateTime.Today & " And EmployeeName =" & EmployeeLogin.usersname
所以