7 Replies Latest reply on Feb 1, 2009 7:47 AM by JR "Bob" Dobbs-qSBHQ2

    cf 8 .net

    craig_mac Level 1
      Hi i 2 question re cf 8

      1. is it possible to create a asp.net user control and then call it via cfinclude?

      2. i have a scheduled task running every 61 seconds, this task loops through a sql server database table and for each record it posts info to a xml url, then deletes that current record.

      this works fine, but i am started to sometimes get up to 10,000 records inserted at one time which can be slow, i am just wondering if there is a better way to do this, ie is schedule task the way to go?

      basically any record that gets inserted into this table must be then posted as xml then deleted.

      i was wondering if i could do somethig sql side of things? i am using sql express 2008
        • 1. Re: cf 8 .net
          Level 7
          craiglaw98 wrote:

          >
          > i was wondering if i could do somethig sql side of things? i am using sql
          > express 2008
          >

          I do not know explicitly for SQL Express 2008, but yes many modern
          Database Management Systems have the ability to out XML directly. I am
          sure it would be worth checking with some SQL Express 2008 documentation
          or resources to see if it is one.

          • 2. Re: cf 8 .net
            craig_mac Level 1
            Hi is there a better way to handle this task?

            basically what i need is this

            1. if there are any entries in the table send out an xml file to a url
            2. then delete the current row

            10,000 records takes a long time, i need to speed this process up somehow?
            • 3. Re: cf 8 .net
              JR "Bob" Dobbs-qSBHQ2 Level 3
              Can you post your code, including database structure if applicable?
              • 4. cf 8 .net
                craig_mac Level 1
                Hi yes my code is simple, there is more content in the xml but dont think its required for this

                <cfloop query="qGetMessages">
                <cfset strURL = (" http://www.url.com") />
                <cfsavecontent variable="strXML">
                XML=<message>#qGetMessages.Info#</message>
                </cfsavecontent>

                <cfhttp url="#strURL#" method="POST" useragent="#CGI.http_user_agent#" result="objGet">
                <cfhttpparam type="XML" value="#strXML.Trim()#" />
                </cfhttp>

                <!--- DELETE CURRENT MESSAGE FROM TABLE--->
                <cfstoredproc procedure="sp_DeleteXML" datasource="#application.ds#">
                <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="MessID" value="#qGetMessages.ID#" null="No">
                </cfstoredproc>
                </cfloop>
                • 5. Re: cf 8 .net
                  JR "Bob" Dobbs-qSBHQ2 Level 3
                  Is it possible to batch all the query results into a single XML document to be posted? This could be an improvement over 10k records being looped over.
                  • 6. Re: cf 8 .net
                    craig_mac Level 1
                    Hi

                    Many thanks for your reply, yes i could do that, but i would need to resolve my other post first, checking if the scheduled task is already being run, as if i do as you surgested, and another schedule starts this could cause duplictes being sent.
                    • 7. Re: cf 8 .net
                      JR "Bob" Dobbs-qSBHQ2 Level 3
                      A couple of ideas to avoid overlapping the execution of your scheduled tasks. Note that I haven't tested any of these ideas.

                      1. Reset the schedule every time the task is run. The first action of the scheduled task is to set it's interval to daily and start time to 6 hours in the future. The last action of the scheduled task is to reset the schedule to the normal value.

                      2. Use an application scope variable. The first action of the task is to check a variable Application.IsMyTaskRunning. If the value is defined and true this means the task is already being executed so no work is done and the task is finished. If the value undefined or false the task sets the value to true then runs normally. On completion the value is set to false.