Solved

Code not working, no error

Posted on 2004-04-20
6
169 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

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…
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

724 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