Or you could do it all via SQL:

<CFQUERY datasource="bwpc" name="TestForExistingQuote">
IF ((Select COUNT(*) FROM SystemQuote WHERE (CFID=#CFID# AND
CFTOKEN=#CFTOKEN#)) > 0)
     DELETE FROM SystemQuote WHERE CFID = #CFID#
</cfquery>

Chris
----------------------------------------------
Original Message
From: "Chris Terrebonne"<[EMAIL PROTECTED]>
Subject: Re:Checking for a record, and then deleting it
Date: Fri, 23 Jun 2000 08:43:08 -0500

>Just test for the RecordCount...
>
><CFQUERY datasource="bwpc" name="TestForExistingQuote">
>Select * FROM SystemQuote WHERE (CFID=#CFID# AND CFTOKEN=#CFTOKEN#)
></cfquery>
>
><CFIF TestForExistingQuote.RecordCount>
>       <CFQUERY datasource="bwpc">
>       DELETE FROM SystemQuote WHERE CFID = #CFID#
>       </cfquery>
></cfif>
>
>----------------------------------------------
>Original Message
>From: "Chris Farrugia"<[EMAIL PROTECTED]>
>Subject: Checking for a record, and then deleting it
>Date: Thu, 22 Jun 2000 21:24:46 -0400
>
>>I have a table in a database that contains the fields CFID, CFTOKEN, WDDX
>>(which is an array that I used CFWDDX on), and the date.  It is for a
>system
>>configurator for new computer systems.  When someone fills in the forms
for
>>what they want on their system, it puts it in a database, then they can
>>click a reconfigure button...  that takes them back to the form they just
>>filled out so they can reconfigure their system.  THen they hit the submit
>>button again and here I need to check if a record in the quotes table
>>already exists (meaning this is at least the second time they've
configured
>>a system), and if it exists, then that record needs to be deleted.  Here
is
>>the code I've tried but it doesn't work:
>>
>><CFQUERY datasource="bwpc" name="TestForExistingQuote">
>>Select * FROM SystemQuote WHERE (CFID=#CFID# AND CFTOKEN=#CFTOKEN#)
>></cfquery>
>>
>><CFOUTPUT Query="TestForExistingQuote">
>><CFIF IsDefined('#WDDX#')>
>>      <CFQUERY datasource="bwpc">
>>      DELETE FROM SystemQuote WHERE CFID = #CFID#
>>      </cfquery>
>></cfif>
>></cfoutput>
>>
>>
>>Does anybody know of a way of doing this?  Thanks in advance.
>>
>>--------------------------------------------------------------------------
-
>---
>>Archives: http://www.eGroups.com/list/cf-talk
>>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>>
>
>_____________________________________________
>Free email with personality! Over 200 domains!
>http://www.MyOwnEmail.com
>
>---------------------------------------------------------------------------
---
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

_____________________________________________
Free email with personality! Over 200 domains!
http://www.MyOwnEmail.com

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to