Solved

Code not working, no error

Posted on 2004-04-20
6
162 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 6

Accepted Solution

by:
PE_CF_DEV earned 250 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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