| Author |
how to construct a sql query when field having single quote
|
zimbu bolleddu
Ranch Hand
Joined: Jan 14, 2008
Posts: 35
|
|
Hi all, I have been working on web application , here is my requirement: I'm constructing sql statement dynamically from dynamic user input (form data). In one of the field having single quote. while executing the query it is getting problem because of single quote .. so how do i resolve my problem. single quote should be there. (I'm using Ms-Access as my database). Thanks in advance zimbu
|
 |
Amit Ghorpade
Bartender
Joined: Jun 06, 2007
Posts: 2552
|
|
|
Please CarefullyChooseOneForum for your post.This ensures desired response for your post.
|
SCJP, SCWCD.
|Asking Good Questions|
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8441
|
|
Originally posted by Amit Ghorpade: Please CarefullyChooseOneForum for your post.This ensures desired response for your post.
Moving to JDBC forum.
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
|
|
|
Are you using a PreparedStatement or passing the text directly? If you have the text directly you may need to convert the ' to \'. I don't know whether PreparedStatements will automatically escape the ' for youi.
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
Originally posted by Campbell Ritchie: I don't know whether PreparedStatements will automatically escape the ' for you.
Yes , It will escape the single quote ('). Shailesh
|
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
|
|
Originally posted by Shailesh Chandra: Yes , It will escape the single quote ('). Shailesh
Thank you, and that's good. I hoped that is what it did, but thought I had better say "don't know" because I wasn't sure.
|
 |
 |
|
|
subject: how to construct a sql query when field having single quote
|
|
|