8 Replies Latest reply on Nov 25, 2007 5:39 PM by cf_dev2

    Doesn't enter info

    Team_Source
      I need the following to enter info into the database if information is in the InsertRecord2 query. It acts like it is passing but it only enters the information entered into the first InsertRecord query. Can anyone tell me what I am missing?
        • 1. Doesn't enter info
          jdeline Level 1
          Please post the relevant code.
          • 2. Re: Doesn't enter info
            Team_Source Level 1
            Sorry, I thought that I had -

            <cftransaction>
            <cfquery name="InsertRecord" datasource="NBProdReports">
            Insert Into TblMasterTrans (Time_Spent, Date_Opened) Values (#form.Time_Spent#, '#form.Date_Opened#')
            </cfquery>

            <cfquery name="InsertRecord1" datasource="NBProdReports">
            Insert Into TblContractInfo_SubMenuTable (Task_Number, User_ID, Contract_Number,
            Transaction_Type , Num_Checks_Trans , Notes)
            SELECT MAX(TblMasterTrans.Task_Number),'#form.UserID#','#form.Contract_Number#',
            '#form.Trans_Type#','#form.Num_Checks_Trans#',
            <cfqueryparam value="#FORM.Notes#"
            null="yes">
            From TblMasterTrans
            </cfquery>

            <cfif IsDefined("form.Trans_Type2")>
            <cfelse>
            <cfif len(trim(form.Trans_Type2)) gt 0>
            <cfquery name="InsertRecord2" datasource="NBProdReports">
            Insert Into TblContractInfo_SubMenuTable (Task_Number, User_ID, Contract_Number,
            Transaction_Type , Num_Checks_Trans)
            SELECT MAX(TblMasterTrans.Task_Number),'#form.UserID#','#form.Contract_Number#',
            '#form.Trans_Type2#','#form.Num_Checks_Trans2#',
            From TblMasterTrans
            </cfquery>
            </cfif>
            </cfif>
            </cftransaction>
            • 3. Re: Doesn't enter info
              Level 7


              Team_Source wrote:
              >
              > <cfif IsDefined("form.Trans_Type2")>
              > <cfelse>

              here is your problem if your form.Trans_Type2 is a textbox, which it
              looks like it is.
              the below code will NEVER run because a textbox is ALWAYS defined, even
              if it is blank.
              so the <cfelse> part will never fire.

              > <cfif len(trim(form.Trans_Type2)) gt 0>
              > <cfquery name="InsertRecord2" datasource="NBProdReports">
              > Insert Into TblContractInfo_SubMenuTable (Task_Number, User_ID,
              > Contract_Number,
              > Transaction_Type , Num_Checks_Trans)
              > SELECT
              > MAX(TblMasterTrans.Task_Number),'#form.UserID#','#form.Contract_Number#',
              > '#form.Trans_Type2#','#form.Num_Checks_Trans2#',
              > From TblMasterTrans
              > </cfquery>
              > </cfif>
              > </cfif>
              > </cftransaction>
              >
              >



              ---
              Azadi Saryev
              Sabai-dee.com
              http://www.sabai-dee.com
              • 4. Re: Doesn't enter info
                Team_Source Level 1
                Any suggestions how we can get around this? The Trans_Type2 has to be a text because the options are pulling from a table in the database.
                • 5. Doesn't enter info
                  jdeline Level 1
                  Simply delete these two lines of code:

                  <cfif IsDefined("form.Trans_Type2")>
                  <cfelse>

                  The next line of code, <cfif len(trim(form.Trans_Type2)) gt 0>, is sufficient to cause the block to execute if there is anything in the text box.

                  Of course, you will want to delete the corresponding </CFIF> at the bottom.
                  • 6. Re: Doesn't enter info
                    Team_Source Level 1
                    We have tried removing those lines but then when you try to submit the form, it says page cannot be displayed. We do have debugging turned on on the admin side of the server. Any further suggestions? Could this be an issue with the database?
                    • 7. Re: Doesn't enter info
                      jdeline Level 1
                      Copy and paste the error message, please.
                      • 8. Re: Doesn't enter info
                        cf_dev2 Level 1
                        Team_Source wrote:
                        > SELECT MAX(TblMasterTrans.Task_Number),

                        Are you trying to increment the value? ie MAX(Number) + 1?


                        > it says page cannot be displayed.

                        Disable friendly http error messages
                        http://support.microsoft.com/kb/294807


                        > '#form.Num_Checks_Trans2#' (, comma here)
                        > From TblMasterTrans

                        Remove the extra comma between the last column and the FROM clause