Solved

Code not working, no error

Posted on 2004-04-20
6
165 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 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