Solved

CF - Identitycol is undefined

Posted on 2011-03-16
4
970 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now