« Previous Next »

Thread: Query works via logparser window but won't work via COM programming

Last post 07-17-2009 3:36 PM by maximusdm. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 07-17-2009, 1:18 PM

    Query works via logparser window but won't work via COM programming

    Hi all,

    The query below works fine when I ran it off the logparser window: 

    logparser "select date1,date2,id1 INTO C:\Sink.csv FROM C:\Sink.log WHERE date1 > '2009:07:15 16:30:31:36'"
     -i:CSV -iHeaderFile:"c:\Header.csv" -nSkipLines:2 -iTsFormat:"yyyy-MM-dd?hh:mm:ss"

    Using C# and StringBuilder class I have the following output string:

    SELECT date1,date2  INTO 'C:\Sink.csv' FROM c:\Sink.log
     WHERE date1 > '2009-07-17 16:42:17' -i:CSV -iHeaderFile:"c:\Header.csv" -nSkipLines:2
     -iTsFormat:"yyyy-MM-dd?hh:mm:ss"

    also tried with single quotes:

    SELECT date1,date2  INTO 'C:\Sink.csv' FROM c:\Sink.log
     WHERE date1 > '2009-07-17 16:50:36' -i:CSV -iHeaderFile:'c:\Header.csv' -nSkipLines:2
     -iTsFormat:'yyyy-MM-dd?hh:mm:ss'

    When I call "LogParser.ExecuteBatch(query, pObjInput, pObjOutput)" I get the error:

    {"Error parsing query: Syntax Error: extra token(s) after query: '-i:CSV' [SQL query syntax invalid or unsupported.]"}
    System.Exception {System.Runtime.InteropServices.COMException}

    Any ideas?

    Thank you!

    MDM
  • 07-17-2009, 3:36 PM In reply to

    Re: Query works via logparser window but won't work via COM programming

    Found the answer on: http://forums.iis.net/t/1145337.aspx

     

    MDM
Page 1 of 1 (2 items)
Microsoft Communities