我試圖在C#應用程序中實現MS LogParser。這編譯好,但在logQuery.ExecuteBatch()方法莫名其妙地崩潰。 try/catch塊不會捕獲它,除非我特別惡化了szQuery,這表明一切正常,因爲它應該,我只是沒有得到任何輸出。LogParser在C#中無錯誤地崩潰
任何想法爲什麼它可能會崩潰或我可能會發現一些日誌?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using FolderLoggingLib; using MSUtil;
namespace ConsoleApplication20 { class Program { static void Main(string[] args) { //refLog = new BinaryInputFormat(); LogQueryClass logQuery = new LogQueryClass(); ICOMCSVOutputContext output = new COMCSVOutputContextClass(); ILogParserInputContext parse = new BinaryInputFormat();
string szFileName = @"E:\Programming\FolderLogging\2012-05-13.fbl"; string szQuery = "SELECT Folder, User, Record, DB, TO_LOCALTIME(Timestamp) AS DateTime, Operation, Checked FROM " + szFileName + " ORDER BY DateTime DESC"; try { logQuery.ExecuteBatch(szQuery, parse, output); } catch { }; } }
}
嘗試捕捉(例外ex)以查看您得到的異常併發布詳細信息。 –
試過了 - 它永遠不會到達catch塊,程序就會死在logQuery.ExecuteBatch()方法上。 –