title: WSF and ADO with DB2 , recordset.MoveNext not supported error in vbscript
body: <p>I am trying to loop on a recordset returned from db2 using a .wsf file and vbscript .</p>
  
  <p>the vbscript libfile(lib.vbs) is as follows</p>
  
  <pre><code>'***************  
  Const ADOCon="Provider=IBMDADB2.1;Password=*****;User ID=*****;Data Source=yourdatasourc;"
  '************************  
  'ADO environment is Initialised here  
  '*************************  
  Function ADOINI(strDB2Cn)  
    With objConnection  
          .Open strSQLCn  
          .CursorLocation=adUseClient  
    End With  
    If objConnection.Errors.Count &gt; 0 Then  
          ErrorOut "Conncetion has Failed."  
    End If  
    With objCommand  
          .ActiveConnection = objConnection  
          .CommandType = adCmdText           
    End With    
  End Function  
  '********************    
  'Execute ADO Comand  
  'strSQL - SQL Statment to execute     
  'Return ADO RecordSet.  
  '*******************************    
  Function Exec(strSQL)  
      objCommand.CommandText = strSQL  
      Exec=objCommand.Execute  
  End Function  
  '******************************************    
      Function ErrorOut(errMsg)  
          Wscript.StdErr.Write Now()&amp;" "&amp;errMsg&amp;vbCrLf   
      End Function  
  '****************    
      Function StdOut(msg)   
          WScript.StdOut.Write Now()&amp;" "&amp;msg&amp;vbCrLf   
      End Function  
  '************************  
  </code></pre>
  
  <p>I am using a trial.wsf file , to getback a recordset on which i am trying to loop  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;  
  &lt;package xmlns="http://schemas.microsoft.com/WindowsScriptHost"&gt;  
  &lt;job id="main"&gt;  
  &lt;object id="objConnection"  progid="ADODB.Connection" /&gt;  
  &lt;object id="objCommand"     progid="ADODB.Command" /&gt;  
  &lt;object id="objError"       progid="ADODB.Error" /&gt;  
  &lt;reference object="ADODB.Connection" /&gt;  
  &lt;reference object="ADODB.Command" /&gt;  
  &lt;reference object="ADODB.Error" /&gt;  
  
  &lt;script language="VBScript" src="lib.vbs"&gt;  
  
      ADOINI(ADOCon)      
      Set objRS = Exec("SELECT REF_CRSETTINGS.NAME, REF_CRSETTINGS.VALUE FROM   WMRCR.REF_CRSETTINGS REF_CRSETTINGS WHERE TRIM(UPPER(REF_CRSETTINGS.CATEGORY)) IN   ('SAMPLE_SETTINGS') ORDER BY REF_CRSETTINGS.CRSETTINGSCODE")  
  
  ' the above recordset is a name value pair based on the category   
  
   StdOut objRS("NAME").Value 'this worked fine  
  
  objRS.MoveNext ' this doesnt work neither does check for EOF or BOF   
  
  &lt;/script&gt;  
  &lt;/job&gt;  
  &lt;/package&gt;  
  </code></pre>
  
  <p>My intial thinking was that the cursor type might be wrong ,<br>
  but i am not even able to set the cursosr type to dynamic , got a vbscript error not   supported .  </p>
  
  <p>maybe its an issue with the provider , but am not able to confirm that .  </p>
  
  <p>I want to do something like this , but am not able to loop on the recordset ..  </p>
  
  <pre><code>  Do While Not objRS.EOF  
      Select Case UCase(trim(objRS("NAME").Value))  
        Case "SOAPSERVER"   SOAPSERVER=objRS("VALUE").Value  
        Case "SOAPMESSAGE"   SOAPMESSAGE=objRS("VALUE").Value  
        Case "SOAPACTION"   SOAPACTION=objRS("VALUE").Value  
        Case Else   ErrorOut "Error: InCorrect Value"  
       End Select  
          objRS.MoveNext  
      Loop  
  </code></pre>
  
  <p>Am sure there is something basic/silly mistake over here , not well versed with wsf and scripting .. </p>