title: MS Log Parser 2.2 Query Error
body: <p>I am trying to determine if a user downloaded a file from FTP using MS Log Parser 2.2</p>
  
  <p>I have not been able to get parser SQL query going, although I have used several samples queries.</p>
  
  <p><strong>Water Down Parser Query does not work:</strong></p>
  
  <pre class="lang-sql prettyprint-override"><code>strSQL = "SELECT date,COUNT(*) AS downloads,c-ip "
  strSQL = strSQL &amp; "FROM C:\temp\Log\*.log "
  strSQL = strSQL &amp; "WHERE cs-method='RETR' "
  strSQL = strSQL &amp; "GROUP BY date,c-ip "
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>RecordSet cannot be used at this time [Unknown Error]
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>How do I create a query:</p>
  
  <pre><code> - SELECT Date and Time of download
   - Where user = 'xxx' 
   - WHERE RETR = is a download
   - WHERE Filename = u_ex150709.log or xxx
  </code></pre>
  
  <p><strong>Answers in C# are also welcome</strong></p>
  
  <p><strong>VB.net Code:</strong></p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim rsLP As ILogRecordset = Nothing
  Dim rowLP As ILogRecord = Nothing
  
  Dim LogParser As LogQueryClassClass = Nothing
  Dim W3Clog As COMW3CInputContextClassClass = Nothing
  
  Dim UsedBW As Double = 0
  Dim Unitsprocessed As Integer
  
  Dim strSQL As String = Nothing
  
  LogParser = New LogQueryClassClass()
  W3Clog = New COMW3CInputContextClassClass()
  
  Try
  
  strSQL = "SELECT date,COUNT(*) AS downloads,c-ip "
  strSQL = strSQL &amp; "FROM C:\temp\Log\*.log "
  strSQL = strSQL &amp; "WHERE cs-method='RETR' "
  strSQL = strSQL &amp; "GROUP BY date,c-ip "
  
  'run the query against W3C log
  rsLP = LogParser.Execute(strSQL, W3Clog)
  
  'Error occurs in the line below
  rowLP = rsLP.getRecord()
  </code></pre>