Just one thing, SQL Server doesn't need the semi-colons after the
commands in this query, you could happily do

SET NOCOUNT ON
INSERT INTO StaffMembers(FirstName,LastName,EmailAddress)
VALUES(<cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="#Trim(attributes.FirstName)#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="#Trim(attributes.LastName)#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="#Trim(attributes.EmailAddress)#">)
SELECT @@Identity AS StaffMember_id
SET NOCOUNT OFF

Try that, it might make a difference

Also, what does your SQL say in the debug?

Philip Arnold
Technical Director
Certified ColdFusion Developer
ASP Multimedia Limited
Switchboard: +44 (0)20 8680 8099
Fax: +44 (0)20 8686 7911

www.aspmedia.co.uk
www.aspevents.net

An ISO9001 registered company.

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************


> -----Original Message-----
> From: Tyler Silcox [mailto:[EMAIL PROTECTED]]
> Sent: 24 June 2002 22:49
> To: CF-Talk
> Subject: CFQueryParam / @@Identity / CFMX problems>>>
>
>
> I'm getting a crazy error on some of my action pages that use
> <cfqueryparam>
> and SELECT @@IDENTITY after installing CFMX, could one of you
> super MX type
> of people help me out...
>
> this is my error:
>
> Could not find prepared statement with handle -1.
>
> and this is the (abridged) code:
>
> <cfquery name="insertStaffMember"
>     datasource="#request.DB.DataSource#"
>     username="#request.DB.UserName#"
>     password="#request.DB.Password#">
>     SET NOCOUNT ON;
>     INSERT INTO StaffMembers(FirstName,
>         LastName,
>         EmailAddress)
>     VALUES(<cfqueryparam cfsqltype="CF_SQL_VARCHAR"
> value="#Trim(attributes.FirstName)#">,
>         <cfqueryparam cfsqltype="CF_SQL_VARCHAR"
> value="#Trim(attributes.LastName)#">,
>         <cfqueryparam cfsqltype="CF_SQL_VARCHAR"
> value="#Trim(attributes.EmailAddress)#">);
>     SELECT @@Identity AS StaffMember_id;
>     SET NOCOUNT OFF;
> </cfquery>
>
> ..then I run another query here that loops through a list
> office_ids that
> inserts the freshly submitted StaffMember_id and ties them to
> different/multiple offices.  I really don't want to give up
> on my queryparam
> tags just yet, but that's the only workaround I can find->
>
> Tyler Silcox
> email | [EMAIL PROTECTED]
>
>
> 
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to