Solved

CF - Identitycol is undefined

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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
If in a where clause in t-sql 7 52
Database Owner 3 45
MSSQL Convert Char to Date Time 5 36
SQL Server how to use a VARIABLE to link tables in a SQL Script? 3 41
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
In this article I will describe the Detach & Attach 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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

732 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