title: Is it possible to enumerate the field names of an ADO Recordset with JavaScript and cscript?
body: <p>I am writing some scripts to run on old Windows NT machines. I am planning on using the command-based script host (cscript) to execute them. The script are querying some SQL data and I want to retrieve the field names from the RecordSet, but it doesn't seem to work.</p>
  
  <p>This is the code I'm using:</p>
  
  <pre><code>rs.open(query, conn, adOpenForwardOnly, adLockReadOnly);
  
  
  rs.MoveFirst();
  while(!rs.eof) {
   for(field in rs.Fields) {
    WScript.Echo(field.Name); /* outputs nothing */
  
   }
      WScript.Echo(rs.Fields("column")); /* outputs the column value for this record (as expected)*/
  
   rs.MoveNext();
  }
  
  rs.close();
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>Tried this as well:</p>
  
  <pre><code>while(!rs.eof) {
      WScript.Echo(rs.Fields.length); /* doesn't print anything */
      for(var i = 0; i&lt; rs.Fields.length; i++) { /* loop isn't entered */
          WScript.Echo(rs.Fields(i).Name);
      }
      rs.MoveNext();
  }
  </code></pre>