Solved

Code not working, no error

Posted on 2004-04-20
6
155 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
Comment Utility
NM, i got it. it wasn't even this page. i'll contact CS.
Thanks
0
 
LVL 35

Expert Comment

by:mrichmon
Comment Utility
: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
Comment Utility
But once a comment is posted the Delete link goes away....
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 6

Accepted Solution

by:
PE_CF_DEV earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now