title: Out of Memory error when trying to connect to oracle database (VB6)
body: <p>when I m trying to set Recordset using oracle connection string, I m getting OUt of memory error.</p>
  <p>on line &quot;<strong>rsLIS.Open sql, gConnLIS, adOpenStatic, adLockReadOnly</strong>&quot;</p>
  <p>However some time it works like once in 5-6 attempts</p>
  <p>but when it works it gives error on some other line</p>
  <p>on line &quot;<strong>If rsLink.Fields(2).value = rsLIS.Fields(1).value Then</strong>&quot;</p>
  <p>here are the things which I tried :</p>
  <ol>
  <li>instead of directly using recordset, I tried to create array (GetRows) method.</li>
  </ol>
  <p>Even though recordset count is 26 but UBound of array is showing 1</p>
  <ol start="2">
  <li>I have trying changing 3rd argument value from static to forward only
  in line &quot;&quot;rsLIS.Open sql, gConnLIS, adOpenStatic, adLockReadOnly&quot;&quot;</li>
  </ol>
  <p>it also didn't work, it was showing recordset.count as 0</p>
  <ol start="3">
  <li>Did try after restarting the client system still same</li>
  </ol>
  <p>I m getting this error on client side and since at my place I don't have development environment to debug</p>
  <p><strong>Error is &quot;OUT OF MEMORY&quot;</strong></p>
  <pre><code>Public Function GetResults_New(MachName As String, patid As String, bCheckDate As Boolean, SendAssay As Boolean) As ADODB.Recordset
  On Error GoTo errdesc
  Call ShowTempMsg(&quot;Line 1&quot;)
  Dim bXVar As Boolean
  Dim i, j As Integer
  Dim tmplis, tmporder
  Dim tmpresult
  
  bXVar = False
  
  Dim rec_result As New ADODB.Recordset
  
  Dim rsLink As New ADODB.Recordset
  Dim rsLIS As New ADODB.Recordset
  
  Dim xSampleIdType As String
  
  gAppPath = AddEditINIfile(&quot;VAHSIF.INI&quot;, &quot;IF&quot;, &quot;sLinkPath&quot;, &quot;&quot;)
  xSampleIdType = AddEditINIfile(gAppPath &amp; &quot;\sLinkConfig.ini&quot;, MachName, &quot;SampleIdType&quot;, &quot;SampleId1&quot;, False)
  
  Call Open_Connection
  Call Open_Connection_LIS
  rec_result.CursorLocation = adUseClient
  
  
  If SendAssay = True Then
      rec_result.Fields.Append &quot;machineparamid&quot;, adBSTR, 50
      rec_result.Fields.Append &quot;Assayno&quot;, adBSTR, 50
      rec_result.Fields.Append &quot;SType&quot;, adBSTR, 50
      rec_result.Fields.Append &quot;Dilution&quot;, adBSTR, 50
  Else
      rec_result.Fields.Append &quot;machineparamid&quot;, adBSTR, 50
      rec_result.Fields.Append &quot;SType&quot;, adBSTR, 50
      rec_result.Fields.Append &quot;Dilution&quot;, adBSTR, 50
  End If
  
  rec_result.Open
  \
  'Link Query For Mapped Params.
  sql = &quot;SELECT EquipParamMapping.EquipId, EquipParamMapping.EquipParamCode, EquipParamMapping.LISParamCode, EquipParamMapping.EquipAssayNo from EquipParam, EquipParamMapping where equipParam.equipid = equipparammapping.equipid and equipparam.equipparamcode = equipparammapping.equipparamcode and EquipParam.EquipID = '&quot; &amp; MachName &amp; &quot;' and EquipParam.isProgram = 'Y'&quot;
  
  
  **rsLink.Open sql, gConn, adOpenStatic, adLockReadOnly**
  
  
  
  If enumConnTo = connOracle Then
      sql = &quot;select &quot; &amp; xSampleIdType &amp; &quot; , LIS_Param_Code From SL_21CI_View_sampleid_Orders where &quot; &amp; xSampleIdType &amp; &quot; || SuffixCode = '&quot; &amp; patid &amp; &quot;'  and isApplicable &lt;&gt; 'N'  &quot;
  Else
      sql = &quot;select &quot; &amp; xSampleIdType &amp; &quot; , LIS_Param_Code From SL_21CI_View_sampleid_Orders where &quot; &amp; xSampleIdType &amp; &quot; + cast(SuffixCode as varchar(20)) = '&quot; &amp; patid &amp; &quot;'  and isApplicable &lt;&gt; 'N' &quot;
  End If
  
  rsLIS.Open sql, gConnLIS, adOpenStatic, adLockReadOnly
   
  
  While Not rsLIS.EOF
      
      If bXVar = True Then
          rsLink.MoveFirst
          bXVar = False
      End If
      While Not rsLink.EOF
      
          bXVar = True
  
    
          **If rsLink.Fields(2).value = rsLIS.Fields(1).value Then**
           
              If SendAssay = True Then
                 
                  rec_result.AddNew
          
                  rec_result(&quot;machineparamid&quot;) = rsLink.Fields(&quot;EquipParamCode&quot;)
                 
                  rec_result(&quot;Assayno&quot;) = rsLink.Fields(&quot;EquipAssayNo&quot;)
                 
                  rec_result(&quot;SType&quot;) = &quot; &quot;
                 
                  rec_result(&quot;Dilution&quot;) = &quot;0&quot;
                
                  
                  rec_result.Update
                 
                  
                  rec_result.MoveFirst
                
                  
              Else
              
                  rec_result.AddNew
                  
                  rec_result(&quot;machineparamid&quot;) = rsLink.Fields(&quot;EquipParamCode&quot;)
                  rec_result(&quot;SType&quot;) = &quot; &quot;
                  rec_result(&quot;Dilution&quot;) = &quot;0&quot;
                  
                  rec_result.Update
                  
                  rec_result.MoveFirst
              End If
              
              GoTo NextParam
          End If
       
          rsLink.MoveNext
      Wend
  NextParam:
          rsLIS.MoveNext
  Wend
      
  Set GetResults_New = rec_result
      
  Exit Function
  errdesc:
      Call InsertIntoLogWithFileName(&quot;Transaction.GetResults_New&quot; &amp; vbNewLine &amp; sql &amp; vbNewLine &amp; err.Description &amp; &quot;ErrLine : &quot; &amp; ErrLine)
  End Function
  </code></pre>
  <p>Thanks</p>