Advertisement

12.07.2002 at 11:03AM PST, ID: 20418530
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

Dynamic SQL Query Problems with Quotes

Asked by pbguy in ColdFusion Application Server

Tags: , , ,

Thought this would be easier...

Trying to pass a dynamic where clause to a SQL query in Coldfusion (using SQL Server 7)  The where clause is passed in from a form field.   A simplified version  looks like this :

<CFPARAM NAME="pWhereClause" DEFAULT="">

<CFQUERY NAME="qQueryName" ...rest of CF parms...>

SELECT people_id, name
FROM people
WHERE #pWhereClause#

</CFQUERY>

If I pass a check for a numeric value to the query, for example :

people_id = 1

then the query works fine.  But if I a check for a string clause to the query, i.e.

name = 'BILL'

then I get the following error :

---------------------------------------------
Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 13: Incorrect syntax near 'BILL'.

The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (82:1) to (82:98).

---------------------------------------------

I did a CFOUTPUT on the SQL and copied it into isql and the query ran fine outside of ColdFusion, so it seems like a problem with special characters or encoding from the form ( specifically, it doesn't like the single quotes )

Anyone have any idea on how I can get ths working?  Any help would be appreciated!  Thanks

-- Bill



Start Free Trial
[+][-]12.07.2002 at 04:21PM PST, ID: 7548816

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: ColdFusion Application Server
Tags: sql, dynamic, query, quote
Sign Up Now!
Solution Provided By: rweezy
Participating Experts: 3
Solution Grade: B
 
 
[+][-]12.08.2002 at 08:35AM PST, ID: 7550538

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.08.2002 at 08:47AM PST, ID: 7550560

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.08.2002 at 10:21AM PST, ID: 7550819

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.08.2002 at 12:34PM PST, ID: 7551135

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.18.2003 at 01:26PM PST, ID: 7977354

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42