Solved

Yet another single quote problem.

Posted on 2003-11-10
2
205 Views
Last Modified: 2013-12-24
Hi Guys,

I am using the following code-

--------------- Code start ------------------------
<cfset basicquery = "select v.PRDVER as q1_ver from TBLISS t, TBLPRDVER v                        where v.PRDVERID = t.PRDVERID >

<cfif isDefined("version") and #version# NEQ "">
   <cfset addquery = " and t.PRDCHAINID in (select PRDCHAINID from
                                             TBLPRDCHAIN where t.PRDVERID in
                                             (select prdverid from TBLPRDVER where  
                                              v.prdver = '#version#')) " >
   <cfset addquery = Insert(basicquery, addquery, 0)>
   <cfset basicquery = addquery>
</cfif>

<cfquery datasource="its" name="q1">
   #basicquery#
</cfquery>
----------------- Code end ---------------------------

In the first initialization of "addquery", the value of #version# which is enclosed here in single quotes, is converted as if enclosed in double quotes when the query is executed.

How can I get rid of this problem?

Thanks,
Smita

0
Comment
Question by:smita_raut
  • 2
2 Comments
 
LVL 11

Accepted Solution

by:
hart earned 100 total points
ID: 9712992
try this out

<cfset basicquery = "select v.PRDVER as q1_ver from TBLISS t, TBLPRDVER v                       where v.PRDVERID = t.PRDVERID >

<cfif isDefined("version") and #version# NEQ "">
  <cfset addquery = " and t.PRDCHAINID in (select PRDCHAINID from
                                            TBLPRDCHAIN where t.PRDVERID in
                                            (select prdverid from TBLPRDVER where  
                                             v.prdver = '#version#')) " >
  <cfset basicquery = basicquery & addquery>
</cfif>

<cfquery datasource="its" name="q1">
  #PreserveSingleQuotes(basicquery)#
</cfquery>

Regards
Hart
0
 
LVL 11

Expert Comment

by:hart
ID: 9713133
:-)

Regards
Hart [Harish Nair]
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now