Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Adding Double Quotes to My String
Steve Dyke
Ranch Hand
Posts: 2206
2
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
In the following code I need Double Quotes included with the path
string
. I have tried several things but can not get anythig to work.
Statement drawingChangeSTMT = connection.createStatement(); String drawingChangesql = "insert into webprddt6.drawmext3(recseq, dmdrawno, chngtype, prevchng, crntchng, jobno1, dmcust, cobyfn, cobyln, codate, dtmoved, seatcls, dcnsize, dwgshts, signhist, queloc, relflag, canflag, sopryrty, prtsdisp, page1def, page1path) Values('" + nextRecordIndex + "','" + dwgNo.trim() + "','1','" + revString + "','" + previousRev.trim() + "','" + jobNumberString.toUpperCase().trim() + "','" + customerIDString.trim() + "','" + firstNameString.toUpperCase().trim() + "','" + lastNameString.toUpperCase().trim() + "','" + dateString2 + "','" + dateString2 + "'," + seatClassFlag + ",'" + sizeString + "'," + sheetsString + ",'" + signHistString + "','Writer',0,0,4,2,'A',[I][B]'\\\\gvsvr03\\drawings\\wgen\\" + pre_pdf\\sourcefiles\\generica1.rtf'[/B][/I])" ; drawingChangeSTMT.execute(drawingChangesql);
[edited to try and restore readability]
[ July 13, 2007: Message edited by: Fred Rosenberger ]
Gavin Tranter
Ranch Hand
Posts: 333
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
try using the escape charactor for "
\" -> "
\\ -> \
\n -> newline
\t -> tab
hope this helps
G
Gavin Tranter
Ranch Hand
Posts: 333
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Seems my post was broken somehow possible because I include escape charactors???
Anyway trying using the escape charactor for " which is a backslash followed by "
hope that helps
G
Steve Dyke
Ranch Hand
Posts: 2206
2
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks, that works great.
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Note that this kind of code leaves you wide open to SQL injection attacks;
you should
be using PreparedStatement, which will not only handle that for you, but also will be a heck of a lot easier than building up a complex string like this!
[Jess in Action]
[AskingGoodQuestions]
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
StringSplit regex question: missing part of my string?
Identifier too long exception in SQL server 7
How do you pass a string from servlet to jsp if jsp is on another server?
How to use trim() with String.split(regx)?
How to escape smart quotes in java?
More...