Not that this will solve your problem, but it will speed up your page:
 
Instead of your code use this:
 
<cfquery name="qryGetHitCount" datasource="#request.dsn#">
    UPDATE tblContent SET numHitCount = numHitCount + 1 WHERE numContentID=#Request.stAttributes.numContentID#
</cfquery>
 
One query is (almost) always better than 2.
 
Shan
 
 
-----Original Message-----
From: Tom Schreck [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 17, 2002 3:45 PM
To: [EMAIL PROTECTED]
Subject: RE: HELP: Strange CF Problem

No, I’m on the dev environment and nobody’s there except 1 other developer and he was in my office scratching his head.  I do have it in a transaction.  I heard of situations where code would run 2 times inside a custom tag.  But I moved it to inside the calling page.  No cfmodules.  No custom tags.  Straight sql.

 

Thanks -

 

Tom Schreck

817-252-4900

[EMAIL PROTECTED]

 

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

 

- Thomas Edison

 

-----Original Message-----
From: Timothy Heald [mailto:[EMAIL PROTECTED]]
Sent:
Friday, May 17, 2002 3:39 PM
To: [EMAIL PROTECTED]
Subject: RE: HELP: Strange CF Problem

 

Is it in a transaction?  Is it possible that you are having enough traffic that it is actually getting two requests at a time?

 

Tim Heald
ACP/CCFD :)
Application Development
www.schoollink.net

-----Original Message-----
From: Tom Schreck [mailto:[EMAIL PROTECTED]]
Sent:
Friday, May 17, 2002 4:33 PM
To: [EMAIL PROTECTED]
Subject: RE: HELP: Strange CF Problem

I forgot to mention that after my update I did subsequent select statements to retrieve the new numHitCOunt and each time it would return the correct value.  I check the database and it would have the incorrect value.  I did a subsequent query in OnRequestEnd even.  Tried stopping and restarting CF Server.  No Luck.

 

I was thinking a trigger, however, I’ve opened the original stored proc in query analyzer, passed the content id and it incremented by 1.  Looks like a Cold Fusion error.

 

Thanks -

 

Tom Schreck

817-252-4900

[EMAIL PROTECTED]

 

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

 

- Thomas Edison

 

-----Original Message-----
From: Schreck, Tom
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

 

==^================================================================
This email was sent to: [EMAIL PROTECTED]
 
EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bWanp4
Or send an email to: [EMAIL PROTECTED]
 
T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================
==^================================================================
This email was sent to: [EMAIL PROTECTED]
 
EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bWanp4
Or send an email to: [EMAIL PROTECTED]
 
T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================
==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9
Or send an email to: [EMAIL PROTECTED]

T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================

Reply via email to