reset or clear cfquery
I am working with some old cold fusion code (see below for details) and there is a process where it does a cfquery from a database which has the name of 'vRecipients'.
Later in the code it does a cfmail using the vRecripients query to send emails. Recently we had an issue where in a loop it used the same email. Is there a way where for each loop I can clear the cfquery?
Sample code:
<cfif param_Queried EQ 0>
<CFQUERY datasource="#dsn#" name="vRecipients" username="#cf_username#" password="#cf_password#">
SELECT EmailAddress FROM table WHERE field = '#param_ClientID#'
</CFQUERY>
</cfif>
<CFMAIL query="vRecipients" to="#EmailAddress#" from="email@domain.com" subject="Subject" TYPE="HTML">
Body of email goes here
</CFMAIL>
server.ColdFusion.ProductLevel = Professional
server.ColdFusion.ProductName = ColdFusion Server
server.ColdFusion.ProductVersion = 5, 0, 0, 0
server.OS.AdditionalInformation = Service Pack 4
server.OS.BuildNumber = 2195
server.OS.Name = Windows NT
server.OS.Version = 5.0