Title: Message
That exact thing has happened to me and to this day do not know why.  Only I was inserting records into the db and it was doing it twice.  Nowhere else on the server, were there 2 db transactions per query.  However, 1 template just decided it was going to run twice no matter what. I tried different template names, query names, and everything, it just didn't work.  I ended up having to use an IF Exists on the DB side of things to work around it.  I've spoken with other developers and they have seen similar bugs, and there are even stranger things that happen.  So, I guess to work around the issue, you can write the stored procedure to compare a date or some UUID where it looks to see if the UUID is different for every call. 
 
Robert
-----Original Message-----
From: Schreck, Tom [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 3:27 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: HELP: Strange CF Problem

I have a stored procedure being called via cfmodule that queries a specific record, retrieves its hit count, then increments the hitcount by 1.  We noticed the hit count being updated by 2.  I figured something's wrong with the stored procedure.  I replaced the stored proc call in the cfmodule call with actual sql query to retrieve the hit count then a second query to update hitcount by 1.  Record is still getting updated by 2.  So I figure somehow the cfmodule is getting called twice.  So I then remove the call to the cfmodule and replace it with a query to retrieve the hitcount and a second query to increment the hitcount by 1.  Record is still getting updated by 2.  So I figure there's a call somewhere else that's causing the record to be updated.  I removed the 2 queries to update hitcount all together.  Re run the page and hit count does NOT get updated.  So it's pretty evident that the 1 query is updating record by 2 versus 1.

 

Here's my code:

 

<cfquery name="qryGetHitCount" datasource="#request.dsn#">

            SELECT numHitCount FROM tblContent WHERE numContentID=#Request.stAttributes.numContentID#

</cfquery>

 

<cfset tmpCount = qryGetHitCount.numHitCount+1>

 

<cfquery name="qryGetHitCount" datasource="#Request.dsn#">

            UPDATE tblContent

            SET numHitCount = #tmpCount#

            WHERE numContentID = #Request.stAttributes.numContentID#

</cfquery>

 

I've tried putting the calculation inside the second query versus using a variable.  I've tried <cfabort> right after update query and it still updates by 2.  I'm using SQL Server 2000.  I've change the data type from tinyInt to Int to numeric and it all gets updated by 2.  Out of desperation, I change from +1 to +.5 and no luck L.  This phenomenon Is occurring on our Production and Development box. 

 

Interesting enough, I use the same procedure for a different site and it updates the recordcount by 1.  HELP

 

Thanks -

 

Tom Schreck

817-252-4900

[EMAIL PROTECTED]

 

I have not failed.  I've found 10,000 ways that won't work.

 

- Thomas Edison

 

Reply via email to