Hi!
Why don't you just find and replace all single quotes (') with 2 single
quotes (''). Works fine with Oracle and MS SQL Server!
Vinay
-----Original Message-----
From: Scott Evans [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 05, 2000 6:46 PM
To: [EMAIL PROTECTED]
Subject: Re: how to insert a filed consisting of single quote in msaccess?
PreparedStatements automatically escape quotes and other problematic
characters in the form that your database expects them to be escaped.
Otherwise, you have to do it by hand, and you may have to change how you
escape some things if you change your database.
Note that this won't protect you from users embedding html tags in your
forms which can mess up your jsp output.
Scott Evans
-----Original Message-----
From: Khem Chand Sachdeva
[mailto:[EMAIL PROTECTED]]
Sent: Monday, June 05, 2000 12:07 PM
To: [EMAIL PROTECTED]
Subject: Re: how to insert a filed consisting of
single quote in msaccess?
how exactly using PreparedStatement will help in this
case
hoping for a answer,
khem,
Kishore Raghavan wrote:
> Wensj,
>
> You do lot of effort in getting rid of characters like
quotes etc... How
> many such characters will you keep replacing ???
>
> Use PreparedStatements in your inserts. All your
problems
will get solved
> automatically. Tap the power of JDBC please
>
> Kishore Raghavan
>
> -----Original Message-----
> From: A mailing list about Java Server Pages
specification
and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of wensj
> Sent: Monday, June 05, 2000 2:23 AM
> To: [EMAIL PROTECTED]
> Subject: Re: how to insert a filed consisting of
single
quote in
> msaccess?
>
> hi:
> i'm met this question,this because your text field
include character
> "\'".
> in SQL statement,it's look as separater.
> eg: when you insert "b'day" as the third field into
table.
> SQL statement is: insert into table
values('aa','bb','b'day'.....)
> at this time, it cause SQLException: "comma
wanting";
> how can we aviod this problem?
> i'm througth two ways
> one is: not permit input "\'" at text field.
> the other is: before insert,use other character
replace it.
> eg:
> <% String
tmpstr=request.getParameter("strwithspe");
> tmpstr=tmpstr.replace("\'","~");
> %>
> user "~" replace "\'",
> when you get data from database,you must replace
character "~" with
> "\'".
>
>
ok?
>
> ----- Original Message -----
> From: Kotireddy Mutyam <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, June 05, 2000 3:56 PM
> Subject: how to insert a filed consisting of single
quote
in msaccess?
>
> > hi friends,
> > I am working on JSP using JRun with MSAccess as a
Database.
> > I am not able to insert a field for example if i
enter
the value in text
> > field like "b'day" it is throwing exception.
How
to overcome the
> > error?
> > TIA
> > kotireddy
> > [EMAIL PROTECTED]
> >
> >
>
========================================================================
===
> > To unsubscribe: mailto [EMAIL PROTECTED] with
body:
"signoff
> JSP-INTEREST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
========================================================================
===
> To unsubscribe: mailto [EMAIL PROTECTED] with
body:
"signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
========================================================================
===
> To unsubscribe: mailto [EMAIL PROTECTED] with
body:
"signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body:
"signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets