?
Solved

cfqueryparam: Incorrect syntax near '@P3'.

Posted on 2006-03-22
2
Medium Priority
?
1,872 Views
Last Modified: 2013-12-24
What is wrong with this?

<cfquery name="ClientNewInsert" datasource="VanProgram">  
Insert into Clients (ClientID,
     Title,  
     FirstName,  
     LastName,  
     MI,  
     Address,  
     Apt,  
     City,  
     State,  
     Zip,  
     Phone,  
     DOB,
     Lift,  
     Limits,  
     Comments,
     Directions,
     EmerContact,  
     EmerPhone,
     EmerPhone1)
values
(#TheNextClientID#,
     '#form.Title#',  
     '#form.FirstName#',  
     '#form.LastName#',  
     '#form.MI#',  
     '#form.Address#',  
     '#form.Apt#',  
     '#form.City#',  
     'OH',  
     '#form.Zip#',  
     <cfqueryparam value="#REReplace(form.Phone,'[^0-9]','','all')#" cfsqltype="CF_SQL_VARCHAR" />,
     '#form.DOB#',
     '#form.Lift#',  
     '#form.Limits#',  
     '#form.Comments#',
     '#form.Directions#',
     '#form.EmerContact#',  
     <cfqueryparam value="#REReplace(form.EmerPhone,'[^0-9]','','all')#" cfsqltype="CF_SQL_VARCHAR" />,
     <cfqueryparam value="#REReplace(form.EmerPhone1,'[^0-9]','','all')#" cfsqltype="CF_SQL_VARCHAR" />
</cfquery>


Error Executing Database Query.  
[Macromedia][SQLServer JDBC Driver][SQLServer]Line 39: Incorrect syntax near '@P3'.  
 
The error occurred in D:\Inetpub\wwwroot\VanProgram\NewClientInsert.cfm: line 54
 
52 :      '#form.EmerContact#',  
53 :      <cfqueryparam value="#REReplace(form.EmerPhone,'[^0-9]','','all')#" cfsqltype="CF_SQL_VARCHAR" />,
54 :      <cfqueryparam value="#REReplace(form.EmerPhone1,'[^0-9]','','all')#" cfsqltype="CF_SQL_VARCHAR" />
55 : </cfquery>
56 :  

--------------------------------------------------------------------------------
 
SQL    Insert into Clients (ClientID, Title, FirstName, LastName, MI, Address, Apt, City, State, Zip, Phone, DOB, Lift, Limits, Comments, Directions, EmerContact, EmerPhone, EmerPhone1) values (3915, 'DR', 'Test1', 'Test1', 'T', '1234 Test way', '', 'BEREA', 'OH', '41032', (param 1) , '01/01/1950', 'Yes', 'BRING WHEELCHAIR WITH', 'Test', 'test', 'Father', (param 2) , (param 3)  
0
Comment
Question by:JohnLucania
2 Comments
 
LVL 16

Accepted Solution

by:
RCorfman earned 2000 total points
ID: 16265732
You need a closing )

     '#form.EmerContact#',  
     <cfqueryparam value="#REReplace(form.EmerPhone,'[^0-9]','','all')#" cfsqltype="CF_SQL_VARCHAR" />,
     <cfqueryparam value="#REReplace(form.EmerPhone1,'[^0-9]','','all')#" cfsqltype="CF_SQL_VARCHAR" />  )

Notice the closing ) I added.

I would also note that you really should consider using <cfqueryparam> for ALL the form literals passed into the insert... just my opinion.
0
 

Author Comment

by:JohnLucania
ID: 16265792
yup :-)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

749 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