Hi Guys
Thanks for the suggestions, which i tried, but im still getting the same
error. If for example i entered "it's red" in the description field.  the
code is shown, i would be greatful for any further comments:

Thanks


                //Create SQL query
                String query = "INSERT INTO events " +
                       "VALUES(null, " +
                       "'" + type + "', " +
                       "'" + description + "', " +
                       "'" + date + "', " +
                       "'" + today + "')";

                //debug
                System.out.println(query);

                try {
                PreparedStatement s = dbCon.prepareStatement(query);
                s.executeQuery();

                }catch(SQLException e) {

                }

>From: Clayton Nash <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Writing quotes to a DB
>Date: Thu, 19 Apr 2001 16:41:33 +0100
>
>If you use a PreparedStatement the perl type quoting happens automatically
>when you set the attribute you're trying to insert.
>
>Clayton
>
>-----Original Message-----
>From: A mailing list about Java Server Pages specification and reference
>[mailto:[EMAIL PROTECTED]]On Behalf Of Gavin Meehan
>Sent: 19 April 2001 16:25
>To: [EMAIL PROTECTED]
>Subject: Writing quotes to a DB
>
>
>Hi
>
>I have form based application that uses JSP, and a MySQL DB. My problem is
>that when i enter a quote in one of the form fields the SQL insert query
>will fail.
>
>   eg inserting the Damien O' Dowd will fall over because of the single
>quote
>after the O. I know this can eaisly be sorted in Perl using the DBI quote
>function, is there any such method in Java ???
>
>Thanks Damien
>
>
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>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".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>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

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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

Reply via email to