Solved

CF - Identitycol is undefined

Posted on 2011-03-16
4
1,016 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 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