Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Yet another single quote problem.

Posted on 2003-11-10
2
Medium Priority
?
217 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 400 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

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

715 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