Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Report Passing String Contain Single Quote Post Reply Post New Topic
Author Message
david1981
Newbie
Newbie
Avatar

Joined: 26 Oct 2009
Location: Malaysia
Online Status: Offline
Posts: 2
Quote david1981 Replybullet Topic: Crystal Report Passing String Contain Single Quote
     Posted: 26 Oct 2009 at 9:05pm
HI....everybody...
may i know, who know how to pass the string contain the single quote into the crystal report.
i'm using vb6 and crystal report 7.
my coding is as below:-

Dim HouseName as string

HouseName="David's House"

WITH CryRpt
.REPORTFILENAME="C:\Rpt_House.rpt"
.FORMULAS(0)="HouseName= ' " & HouseName & " ' "
.DISCARDSAVEDDATA=TRUE
.DESTINATION=crptToWindow
.ACTION=1
END WITH

i getting the ERROR [20515]-
"THE REMAING TEXT DOES NOT APPEAR TO BE PART OF THE FORMULAR."
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 27 Oct 2009 at 5:38am
Double up the single quote.  In SQL a single quote is a text delimiter, so to get David's into a database you pass David''s...alternatively, you could replace the ' with ^ and in CR change all ^ to '...just a thought
 
HTH
IP IP Logged
david1981
Newbie
Newbie
Avatar

Joined: 26 Oct 2009
Location: Malaysia
Online Status: Offline
Posts: 2
Quote david1981 Replybullet Posted: 27 Oct 2009 at 10:53pm
Thansk for u replying.....
 
i had tried to double up the single quote. but still getting the error.
i know in SQL we need to double up the single quote in order to retrieve/get record from database.
 
my problem now is, i try to direct pass the string (contain single quote)  into the crystal report by using formulas without save the string into database and then retrieve it.
 
i had do the online research but din find any soluction yet.
 
the alternatively way that ur suggested may be i will consider it. but i have to restrict the user entering the character so that they canot enter this character ^
 
beside this, is there any soluction/suggestion to solve my problem?
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum