EventLogQuery中的日期格式?
我想构建查询字符串来查询日期范围内的事件日志。 我正在做如下。 但面对无效的查询错误,“指定的查询无效”。 我将我的查询与Eventlog查看器XML视图中提供的过滤器进行了比较。
* [System [Provider [@Name ='.NET Runtime'or @ Name ='Application Error'or @ Name ='Application Hang'] and TimeCreated [@SystemTime> ='2013-08-13T17:29:56.000Z'和@SystemTime <='2013-08-14T17:29:56.999Z']]]
string queryString = "*[System[Provider[@Name='Application Error' or @Name='Application Hang' or @Name='ThomsonONE' or @Name='DFContainer'] and TimeCreated[@SystemTime>='" + "2013-08-13T04:00:00.000Z" + "' and @SystemTime<='" + "2013-08-14T03:59:59.999Z" + "']]]";
EventLogQuery eventsQuery = new EventLogQuery(fileNames[0], PathType.FilePath, queryString);
EventLogReader logReader = new EventLogReader(eventsQuery);
for (EventRecord eventInstance = logReader.ReadEvent();
null != eventInstance; eventInstance = logReader.ReadEvent())
{
}
请让我知道这个代码中有什么错误?
链接地址: http://www.djcxy.com/p/92495.html