Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

escape character

 
Manal India
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i will to enter some addresses in my database through my java program. but the problem is that i cant enter '(single quote)...bcos there it consider ' as the end of string ...is there any escape character for SQL statements ...
please help me ..
i will bw highly obliged ..
thanks in advance ....
manal ...
 
Premkumar N
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If u want to enter say : "B'Day"
Introduce 2 more single quotes along with it: " B'''Day "
 
Manal India
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is a problem with it ....
my data is coming dynamically ...
i have no idia what is pos of '(siingle quote) ..
 
Premkumar N
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Manal:
check for the presence of single-quotes in that dynamic-string, if it is present, replace it with '''.
Prem
 
Premkumar N
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use
myString.indexOf("'"); get the index and then replace ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic