Michael,

I think I see now what the problem might be.  If the HasardID is a comma
delimited list, instead of looping over the delete query try this:

<!--- be sure we have a list with at least one element --->
<cfif ListLen(attributes.HazardID)>
        <!--- Now delete the items --->
        <cfquery datasource="#request.Datasource#">
                DELETE
            FROM HazMMSLink
        WHERE Haz_ID IN(#attributes.HazardID#)
        </cfquery>
</cfif>


Best regards,

Dennis Powers
UXB Internet - A Web Design and Hosting Company
tel: (203)879-2844  fax: (203)879-6254
http://www.uxbinternet.com/
http://dennis.uxb.net/


-----Original Message-----
From: Tangorre, Michael [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 3:28 PM
To: CF-Talk
Subject: RE: transactions

The problem we are seeing (some of the time, not each and every time) is I
have a list of numbers (comma delimited) comeing over from a multiselect
box.
Instead of tyring to figure out what ones are in the DB as compared to what
ones are in the list, I just delete the entries from the DB totally (in
relation to a specific ID) and then insert the passed in list one element at
a time by looping over a query. It seems that some times the delete is not
committing and when I try to insert I get constraint violations because the
DB still thinks the values are in the table.

does that make sense?

Mike


-----Original Message-----
From: UXBinfo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 3:16 PM
To: CF-Talk
Subject: RE: transactions


Mike,

We also still use CF4.0.1 (and yes it seems to scare people away in the
forum).  We perform the same type of queries, delete followed by an insert,
without a problem in several of our applications. What is the problem you
are seeing?


Best regards,

Dennis Powers
UXB Internet - A Web Design and Hosting Company
tel: (203)879-2844  fax: (203)879-6254
http://www.uxbinternet.com/
http://dennis.uxb.net/


-----Original Message-----
From: Tangorre, Michael [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 11:19 AM
To: CF-Talk
Subject: transactions

Hello everyone.

I could use some thoughts on the following problem I am having. I have a
query that deletes all records in a table with a certain value in the ID
field. I then turn around and insert records back into the same table (some
of which might be the same as I just deleted). What I think is happening is
that the delete is not being committed to the DB before I do the insert.
Unfortunately I am on CF 4.01, which does not make life any easier. Any
insight would be greatly appreciated. My code thus far is below.


 <cftransaction>
      <cfquery datasource="#request.Datasource#">
       DELETE
       FROM HazMMSLink
       WHERE
        Haz_ID = #attributes.HazardID#
      </cfquery>
      <cftransaction action="COMMIT" />
 </cftransaction>

 <cfif attributes.SelectedMakeModelSeries NEQ 0>
  <cfloop index="i" list="#attributes.SelectedMakeModelSeries#"
delimiters=",">
    <cfquery datasource="#request.Datasource#">
     INSERT INTO HazMMSLink
      (
      Haz_ID,
      MMS_ID,
      Record_Change_User_ID
      )
     VALUES (
       #attributes.HazardID#,
       #i#,
       #request.UserInfo.UserID#
       )
    </cfquery>
  </cfloop>
 </cfif>


Thanks,

Michael T. Tangorre

----------------------------------------
MillenniuM Information Systems
1101 Wilson Blvd. Suite 1200
Arlington, Virginia 22209

O: 703-341-1438
C: 607-426-9277
----------------------------------------
Golden Rule:
"He who has the gold, makes the rules!"





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to