Forums Register Login

Apostrophe Problem in String

+Pie Number of slices to send: Send
among many other fields, I have a text area that I am getting and entereing into an SQL database. The problem is that if you use a contraction like CAN'T or DON'T or WON'T, in other words, inlcuding an apostrophe in the text field, SQL throws an exception because String literals are added to the DB using ' '. Does anyone know of a work around without telling the users they can't use certain characters in typing?
Thanks
+Pie Number of slices to send: Send
im sure our moderator knows the answer for that one !
+Pie Number of slices to send: Send
Actually, I figured it out. PreparedStatement instead of Statement.
+Pie Number of slices to send: Send
 

Originally posted by Roy Ben Ami:
im sure our moderator knows the answer for that one !


Hmm, trouble maker, eh?
You could just paste a link instead

(If you did a search on my name a PreparedStatement you'd probably get stacks of hits. What can I say, I'm a fan. )
+Pie Number of slices to send: Send
sorry David, i only meant it as a freindly joke.
no pan intended.
point taken.
+Pie Number of slices to send: Send
and I completely took it as a friendly poke!
No stress caused!

Dave.
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 979 times.
Similar Threads
Opening a text file in MS Excel - without data type conversion?
SQL
retain apostrophe in Collection object
Sniffing out apostrophe's in SQL Server
Punctuation is kicking my butt!
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:24:24.