以下代码每次迭代都会写入屏幕。根据我对the DateDiff documentation的理解,它应该每30秒写一次。我做错了什么?
lasttime = Now
Do While Not data.eof
'looping through database records
if DateDiff(s,lasttime,Now) >= 30 Then
lasttime = Now
WScript.Echo "It's been 30 seconds..."
End if
Loop
答案 0 :(得分:1)
更改此行:
if DateDiff(s,lasttime,Now) >= 30 Then
对此(注意“s”周围的引号)
if DateDiff("s",lasttime,Now) >= 30 Then