4 Replies - 2112 Views - Last Post: 28 July 2011 - 11:23 AM Rate Topic: -----

#1 bahareh77  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-July 11

Element ... is undefined in ....

Posted 28 July 2011 - 08:28 AM

Hello All,

I'm going to change my current hosting to another one.
my program is work fine in the current one but in the new one I get this error :
"Element NEWID is undefined in LOGININFO"

here is the code:
<cfquery datasource="mssqlcf_dbsdccc2005" name="LoginInfo">
DECLARE @return_value int,
@VerificationCode nvarchar(10)

EXEC @return_value = [dbo].[SP_GenerateVerificationCode]
@Length = 10,
@VerificationCode = @VerificationCode OUTPUT

INSERT INTO Account_Login
(CompanyId, Email, Password, VerificationCode)
VALUES
('#url.onviewlogins#','#sqlSafe(form.Email)#','#EncryptedPassword#',@Verificat ionCode)

SELECT @@Identity AS newId, @VerificationCode as AccountLoginVerCode
</cfquery>

<cfquery datasource="mssqlcf_dbsdccc2005" name="ContactInfo">
INSERT INTO Account_ContactInfo
(CompanyId, UserLoginId, FirstName, LastName, Address1, Address2, CityStateZip, Phone, Fax, Comments)
VALUES
('#url.onviewlogins#','#LoginInfo.newId#','#sqlSafe(form.ContactFirstName)#',' #sqlSafe(form.ContactLastName)#','#sqlSafe(form.Address1)#','#sqlSafe(form.Add ress2)#','#sqlSafe(form.CityStateZip)#','#sqlSafe(form.ContactPhone)#','#sqlSa fe(form.Fax)#','')
</cfquery>


the second query doesn't work... what is the problem? Does it depend on the SQL Server? because my new hosting use SQL 2005.
Note: I didn't write this code and this is written in CF8

if someone could help me I really appreciate.
Thanks

This post has been edited by Craig328: 28 July 2011 - 09:25 AM
Reason for edit:: Edited for addition of code tags...please enclose your code in code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Element ... is undefined in ....

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1866
  • View blog
  • Posts: 3,389
  • Joined: 13-January 08

Re: Element ... is undefined in ....

Posted 28 July 2011 - 09:34 AM

I'm guessing this isn't really a CF issue but more of what's going on in your initial query so yes, it probably depends on the SQL Server database you're using. You have a stored procedure called "SP_GenerateVerificationCode". If that's not firing correctly (and depending on your error settings you may not be seeing it fail) it could be screwing up what you have going on.

Try adding this on line 16 between the CFQUERYs and see what it shows you:
<cfdump var="#LoginInfo#"><cfabort>


That will dump what's coming back from your LoginInfo query. What it's doing can be broken down into smaller individual steps but you have to have @return_value from the stored procedure...which means if you haven't properly copied the stored proc over, it's likely not working correctly or at all...and that would prevent your code from successfully executing the @@Identity command on line 14.

That said, it looks like someone got very needlessly fancy just trying to generate a unique ten digit verification code. There's lots of ways to generate a unique identifier that doesn't go through all that crapola.
Was This Post Helpful? 0
  • +
  • -

#3 bahareh77  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-July 11

Re: Element ... is undefined in ....

Posted 28 July 2011 - 10:08 AM

Hi Craig

Thanks for your attention to my post, always you reply my post very quickly
I find the solution
I added this line of code at the first of the query:
SET NOCOUNT ON

and added this one at the end of it:
SET NOCOUNT OFF

and whatever it does, it works now :)
Was This Post Helpful? 0
  • +
  • -

#4 bahareh77  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-July 11

Re: Element ... is undefined in ....

Posted 28 July 2011 - 10:25 AM

I find it from this post:
http://www.coldfusio...0after%20insert
Was This Post Helpful? 0
  • +
  • -

#5 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1866
  • View blog
  • Posts: 3,389
  • Joined: 13-January 08

Re: Element ... is undefined in ....

Posted 28 July 2011 - 11:23 AM

Good for you! Glad to hear you found a solution.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1