Solved

Yet another single quote problem.

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

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Coldfusion update database with CFLOOP 5 60
Question to locate the problem 18 79
site launch date and last modified date 3 80
app server have enough resources... 2 23
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 …
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

912 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

15 Experts available now in Live!

Get 1:1 Help Now