• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Doesn't enter info

New Here ,
Nov 21, 2007 Nov 21, 2007

Copy link to clipboard

Copied

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?
TOPICS
Advanced techniques

Views

439

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 21, 2007 Nov 21, 2007

Copy link to clipboard

Copied

Please post the relevant code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 21, 2007 Nov 21, 2007

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 21, 2007 Nov 21, 2007

Copy link to clipboard

Copied



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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 23, 2007 Nov 23, 2007

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 23, 2007 Nov 23, 2007

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 23, 2007 Nov 23, 2007

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 25, 2007 Nov 25, 2007

Copy link to clipboard

Copied

LATEST
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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 24, 2007 Nov 24, 2007

Copy link to clipboard

Copied

Copy and paste the error message, please.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation