?
Solved

Code not working, no error

Posted on 2004-04-20
6
Medium Priority
?
172 Views
Last Modified: 2013-12-24
Greetings and good day,
Simple as the subject title. this chunk of code isn't working.
Can u figure it out?  
note: the bottom URL was coded out to not go to the next page during testing.
note: The Table in the database isn't being appended to.

<cflock timeout=50 scope="Session" type="Exclusive">
      <cfset localAgentID = Session.MasterAgentID >
</cflock>

<!---            NEW ORDERS BUTTON             --->
<cfif IsDefined("Form.btnNewOrder")>

      <cfset localDate = DateFormat(Now(),"mm/dd/yy")>

              <cfquery name = "NewOrder" datasource="webappts">
                  INSERT INTO Orders ( AgentID, OrderDate )
                  VALUES ( #localAgentID#, '#locaDate#' )
            </cfquery>
            
            <cfquery name = "NewOrderDESC" datasource="webappts" maxrows = "1">
                  Select OrderID
                  From Orders
                  Where AgentID EQ #localAgentID#
                  Order By OrderID DESC
            </cfquery>
                        <cflock timeout=50 scope="Session" type="Exclusive">
                  <cfset Session.MasterOrderID = #NewOrderDESC.OrderID# >
            </cflock>

<!---      <cflocation url="ordersadd.cfm">       --->
0
Comment
Question by:phileoca
[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
  • 2
6 Comments
 
LVL 11

Author Comment

by:phileoca
ID: 10872987
NM, i got it. it wasn't even this page. i'll contact CS.
Thanks
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 10872999
:o)

Glad you got it working.

FYI - if no one has posted a comment (I think that even includes you) then you can click the Delete question link without having to have support delete the question for you.
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 10873002
But once a comment is posted the Delete link goes away....
0
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 
LVL 6

Accepted Solution

by:
PE_CF_DEV earned 1000 total points
ID: 10892759
On a side note you may consider revising this:
<cfquery name = "NewOrder" datasource="webappts">
               INSERT INTO Orders ( AgentID, OrderDate )
               VALUES ( #localAgentID#, '#locaDate#' )
          </cfquery>
         
          <cfquery name = "NewOrderDESC" datasource="webappts" maxrows = "1">
               Select OrderID
               From Orders
               Where AgentID EQ #localAgentID#
               Order By OrderID DESC
          </cfquery>
    <cflock timeout=50 scope="Session" type="Exclusive">
               <cfset Session.MasterOrderID = #NewOrderDESC.OrderID# >
          </cflock>

to this:
<cfquery name = "NewOrder" datasource="webappts">
      SET NOCOUNT ON
            INSERT INTO Orders ( AgentID, OrderDate )
            VALUES ( #localAgentID#, '#locaDate#' )
            Select OrderID
            From Orders
            Where OrderID = @@Identity
      SET NOCOUNT OFF
</cfquery>
    <cflock timeout=50 scope="Session" type="Exclusive">
               <cfset Session.MasterOrderID = #NewOrder.OrderID# >
          </cflock>
0
 
LVL 11

Author Comment

by:phileoca
ID: 10901838
heh, thanks for the side note, however, i modified earlier to:

<cfquery name = "NewOrder" datasource="webappts">
      INSERT INTO Orders ( AgentID, OrderDate )
      VALUES ( #localAgentID#, '#localDate#' )
</cfquery>
            
<cfquery name = "NewOrderDESC" datasource="webappts" maxrows = "1">
      Select OrderID
      From Orders                  
      Where AgentID = #localAgentID#
      Order By OrderID DESC
                  
</cfquery>

Query 1: Adding a new Order to the Orders Table
Query 2: Selecting that new order and passing it as a session ID for the remainder of the order

However, what does  the "SET NOCONT ON/OFF do?
0
 
LVL 6

Expert Comment

by:PE_CF_DEV
ID: 10902695
Set NOCOUNT ON/OFF keeps SQL server from returning the row counts. I use it whenever I do more than one statement in a CFquery tag to keep ColdFusion Happy. I haven't seen problems in MX but in earlier versions on ColdFusion if you didn't use SET NOCOUNT it would cause errors.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
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 …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 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