title: How to execute multiple SQL queries in a loop cycle
body: <p>i'm stuck on how to do the task mentioned on the title, you see, a couple of days, maybe weeks i asked how to create some sort of search method to include an entire month, well it's something related to that task that i'm stuck in again -.-'</p>
  
  <p>i came across with the searching method but i can't figure out how to ask the database to bring all the rows matching the search, for example, let's say i enter a search for the current month of november of the current year 2019, and i inserted 5 rows, i need the search to return these five rows inserted this month of the current year.</p>
  
  <p>this is what i'm currently trying with no result</p>
  
  <p><em>the variables mentioned below: 'num_month' and 'num_year' are inserted by search comboboxes in another page, the 'cn_body' thing is the connection string page which is stored somewhere else</em></p>
  
  <pre><code>'CREATION OF COUNTER FOR MONTHS OF 30 DAYS
      '------------------------------------------------------------------------------------
  Set rs_Results = Server.CreateObject("ADODB.Recordset") -(creation of recordset for opening sql query)
  
      If month_num = 4 Or month_num = 6 month_num = 9 Or month_num = 11 Then -(checks the specific months with 30 days)
  
      For day_counter=1 To 30 -(creates a counter for days from 1 to 30 since is the case for months 
  
  of 30 days only)
  
          search_date = cDate(day_counter &amp;"-"&amp; month_num &amp;"-"&amp; year_num) -(inserts the day counter along with the
   month and year counter separating them by "-" making it a valid date after the conversion)
  
          converted_date= Clng(search_date) -(converts the date of the variable 'search_date' to numbers)
      strSQL_CIP_Date="SELECT * FROM data_storage WHERE creation_date=" &amp; converted_date 
  
      'cn_body.execute (strSQL_CIP_Date) -(when using this method on the portion of page that shows the results it throws 
  an error which is: 'ADODB.Recordset error '800a0e78' Operation not allowed if the object is closed.', in this case the 
  query is executed the times it should, but the results aren't shown because of the mentioned error)
  
          rs_Results.open strSQL_CIP_Date,cn_body,1,1 
  
  (cn_body is the string connection which is stored into another page, 
      what i'm doing here is opening the sql query using the recordset which is the method i used for other queries without bigger issues,
      but for some reason here it is not working, only runs 2 times then it appears this error: 
      'ADODB.Recordset error '800a0e79'
  
  'Operation not allowed if the object is open')
  
          response.write day_counter &amp; " " &amp; strSQL_CIP_Date &amp; "&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;" 
  -(prints the query with the converted date to ask to the database)
      Next
  End If
  </code></pre>
  
  <p>i had also tried the looping method with, do, do while, for, if, do while not, loop until, while loop and many more, and had the same result.</p>
  
  <p>so there you have it, i don't know the causes of any of the errors that i mentioned on the code, any kind of help would be great, ask whatever you feel the need to, thanks in advance</p>