Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CF - Identitycol is undefined

Posted on 2011-03-16
4
Medium Priority
?
1,045 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

609 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