Hi,
I'm new to vbscript and I am having alot of problems with the use of &, ' and ". I keep getting the error "unterminated string constant" on this select statement. dtmStartDate and dtmEndDate are variables defined earlier in the script. This code scans (or is attempting to scan) the Windows Event log for a specific code, within a specific date range. The OS is Windows 2000.
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'Application' and EventCode = '1704' and _
TimeWritten >= "' & dtmStartDate & '" and TimeWritten <= "' & dtmEndDate & '"")
For each objEvent in colLoggedEvents
e1.WriteLine "*********"
e1.WriteLine "Oracle DB shutdowns: " & colLoggedEvents.Count
e1.WriteLine "Message: " & objEvent.Message
e1.WriteLine "Time Written: " & objEvent.TimeWritten
e1.WriteLine "Event Code: " & objEvent.EventCode
e1.WriteLine "*********"
e1.WriteBlankLines(1)
Next
I've been searching for a good explanation of this in the Users guide and Reference, but I can't find anything that talks about concatenation and the use of quotes. If anyone has any ideas or can point me to an article that talks about this type of thing, I would really appreciate it.
Thanks,
vbcdor
I'm new to vbscript and I am having alot of problems with the use of &, ' and ". I keep getting the error "unterminated string constant" on this select statement. dtmStartDate and dtmEndDate are variables defined earlier in the script. This code scans (or is attempting to scan) the Windows Event log for a specific code, within a specific date range. The OS is Windows 2000.
Set colLoggedEvents = objWMIService.ExecQuery _
("Select * from Win32_NTLogEvent Where Logfile = 'Application' and EventCode = '1704' and _
TimeWritten >= "' & dtmStartDate & '" and TimeWritten <= "' & dtmEndDate & '"")
For each objEvent in colLoggedEvents
e1.WriteLine "*********"
e1.WriteLine "Oracle DB shutdowns: " & colLoggedEvents.Count
e1.WriteLine "Message: " & objEvent.Message
e1.WriteLine "Time Written: " & objEvent.TimeWritten
e1.WriteLine "Event Code: " & objEvent.EventCode
e1.WriteLine "*********"
e1.WriteBlankLines(1)
Next
I've been searching for a good explanation of this in the Users guide and Reference, but I can't find anything that talks about concatenation and the use of quotes. If anyone has any ideas or can point me to an article that talks about this type of thing, I would really appreciate it.
Thanks,
vbcdor