Solved

Known issues with CFmail and CFquery?

Posted on 2004-09-03
4
311 Views
Last Modified: 2013-12-24
I'm facing a problem with inserting into a db in a cftransaction and right after that sending an e-mail.
the cf transaction contains a number of queries, and last one is the insert query.
I tried both ways (since i would like to send the e-mail only when the data is successfully inserted) to put the cfmail inside the cftransaction tag, and outside it.

In any case, all the queries excute correctly except the insert query. If i remove the cfmail, the problem is still presisting. Only when i delete the query and rewrite it (of course no cfmail in this case) that it works!

Any ideas?
0
Comment
Question by:MMsabry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:hart
ID: 11971210
one suggestion woul be to put all your queries in a stored procedure if possible...
and after the insert quert send a variable out from the stored proc that indicates wether to send the mail or not...

Regards
Hart
0
 
LVL 11

Accepted Solution

by:
hart earned 250 total points
ID: 11971216
also don't put the cfmail inside the cftransaction...
inside cftransaction if an error occurs then set a variable to no...

annd before sending the email check wether the variables value is yes or not...

Regards
Hart
0
 

Author Comment

by:MMsabry
ID: 11971323
That might work, but do you know why the insert does not function when the cfmail tag is there?
i can understand if everything is wrapped in a cftransaction, but when this is not the case!
0
 

Author Comment

by:MMsabry
ID: 11972303
Hart,
Thanks for the ideas, they work, but i made a small modification!
I just initialized a variable default "0", and in the transaction i set it to value "1"
I use a cfif statement, if evaluates to true, i include the e-mail template.
Although i think your solution of stored procedures is more elegant, I have no experience with stored procedures!
thanks once more
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question