Solved

Yet another single quote problem.

Posted on 2003-11-10
2
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

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

Suggested Solutions

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 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