Solved

CF - Identitycol is undefined

Posted on 2011-03-16
4
989 Views
Last Modified: 2012-05-11
Not sure why but I am getting the Element IDENTITYCOL is undefined in ADDED error.  I am using CF8 with SQL 2008.  Any help is appreciated
<cfquery  NAME="Added" datasource="#datasource#">
            INSERT INTO Table (Email)
            VALUES ('#FORM.Email#')
            </cfquery>
           <cflocation url="data_entry_Form2.cfm?id=#Added.identityCol#">

Open in new window

0
Comment
Question by:JohnMac328
  • 2
  • 2
4 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 35149137

> Added.identityCol

this is not the syntax, you can select the identity seperately or use the result="" parameter of the cfquery

<cfquery  NAME="Added" datasource="#datasource#">
    INSERT INTO Table (Email)
   VALUES ('#FORM.Email#')
</cfquery>
<cfquery name="GetPkey" datasource="#request.datasource#">
  select SCOPE_IDENTITY( ) as ID
</cfquery>  
<cfset TheTable_ID = GetPkey.ID>

 
0
 

Author Comment

by:JohnMac328
ID: 35149528
So what would the new <cflocation url="data_entry_Form2.cfm?id=#Added.identityCol#"> syntax be?
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 35149698
The identity comes from the query getPkey and the column is ID in this example

<cfset TheTable_ID = GetPkey.ID>
                               ^^^^^^  this is the variable, you can use it in your cflocation
         or assign it to another variable as I have done here


<cflocation url="data_entry_Form2.cfm?id=#GetPkey.ID#">
0
 

Author Closing Comment

by:JohnMac328
ID: 35149779
Great,

Thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 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