Solved

Yet another single quote problem.

Posted on 2003-11-10
2
209 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 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