Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How Can I add a data in my backend that contains a single quote?  RSS feed

 
Sanjay Bahrani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
How Can I add a data in my backend that contains a single quote, cauze single quotes signifies the end of a string data in sql query.
for eg.
I want to insert the data "How're you" how can i do this.
I have tried with PreparedStatement but it doesn't work for me. If you know something about this plz post the reply....
Thankz...
 
Raajesh Chandran
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!!
If U use Oracle try like this
insert into trial values('how''re u');
Like this put douuble single Quotes in where u need a single quotes within a string.Like this try in prepared stat.If not get it let me know.
Sorry i don't know SQLSERVER
BestWishes,
chandran
 
prabhat kumar
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if u r using 'Statement' to execute ur queries then it wont insert ur queries...if it containd special characters..
for that u will need to use ..
PreparedStatement class and use the various set methods in this class ..
hope it will solve ur problem..
 
Sanjay Bahrani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
Thankz for replying me.....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!