title: ADODB.Recordset error '800a0e7d' The connection cannot be used to perform this operation. It is either closed or invalid in this context
body: <p>I'm getting this error and I can't really find a solution..
  I'm not sql expert, Somebody told me the syntax is not correct, is that right?</p>
  
  <pre><code>ADODB.Recordset error '800a0e7d' 
  The connection cannot be used to perform this operation. It is either closed or invalid in this context. 
  /SelectBanner.inc, line 9 
  </code></pre>
  
  <p>SelectBanner.inc inside:</p>
  
  <pre><code>&lt;%
      sql5 = "SELECT * " &amp;_
              "FROM Banners " &amp;_
              "WHERE BannerNum="&amp;thelocation&amp;" AND TheLanguage='hebrew'"
  
      Set BannersRS = Server.CreateObject("ADODB.Recordset")
      BannersRS.Open sql5, conn, 3, 1
  
      TotalRecords = 0
  
      DO WHILE not (BannersRS.eof)
          TotalRecords=TotalRecords+1
          BannersRS.MoveNext
      LOOP
  
      If (not(BannersRS.bof)) Then
          BannersRS.MoveFirst
      End If
  
      rndMax = TotalRecords
  
      x=0
  %&gt;
  </code></pre>
  
  <p>This is the "connection.asp" file: </p>
  
  <pre><code>&lt;!--#include file=security.asp--&gt; 
  &lt;% 
      set conn = server.createobject("ADODB.connection") 'the next code needed for times when the connection is included from other places than /httpdocs/ 
      ar = Split(server.mappath("."),"\") 
      NewPath = ar(0) 'get the c:\ 
      If ar(index) = "httpdocs" Then 
          index = UBound(ar) 
      Next 
      NewPath = NewPath&amp;"\Data\xxxxxx.mdb" 
      conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&amp;NewPath&amp;";Persist Security Info=False" 
      conn.open() 
      set rs = conn.execute("select * from siteInfo") 
      taxValue = rs("tax") 
      set rs = nothing 
  %&gt;
  </code></pre>