check the string for single quote characters, if you find one, insert
another single quote beside it so it will not generate an error.
e.g. input = O'Reilly
       output = O''Reilly

Try using the String.replace() method.
:^)
Ricky Y. Artigas
Analyst/Programmer
Information Technology Division
Easycall Communications Phils., Inc.
- Easycall Internet -
418 Arayat St., Mandaluyong City 1550, Philippines
Personal WAP Site: http://www.buzzed.co.uk/mobile/?rya
Company Website: http://www.easycall.com.ph
Tel.no: (+632) 5338001 ext.6574
Mobile:(+63) 0917-8951783
Pager:  141-002955
Email: [EMAIL PROTECTED]


> -------------------------------
> IMPORTANT NOTICE:

> This message (and any attachment hereto) may contain privileged and/or
> confidential information specific to EasyCall. If you are not the intended
> addressee indicated in this message, you may not copy or disseminate this
> message (or any attachment hereto) to anyone. Instead, please destroy this
> message (and any attachment hereto), and kindly notify the sender by reply
> email. Any information in this message (and any attachment thereto) that
> do not relate to the official business of EasyCall shall be understood as
> neither given nor endorsed by the company.
>
>
> -----Original Message-----
> From: Jennifer Feeney [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, February 09, 2001 9:57 AM
> To:   [EMAIL PROTECTED]
> Subject:      Servlet Bug!!
>
> Hi all,
>
> Once again, thanks to anyone that can offer any help or advise on
> this one!
>
> I have found a bug in my servlet......
>
> Description:
> ========================================================
> I have a servlet developed that allows users to register for
> a service, it all works great, except for one thing, if a person
> enters a Surname of the O'Rourke, O'Reilly, type I get the following
> message........
>
> java.sql>SQLException:Syntax Error(Missing Operator) in expression
> Query.
>
> I know what causes the error, its the " ' " character that messes
> up my InsertIntoDB query......
>
> The code snippet below is what I am using, can anyone tell me how i
> could modify it to allow surnames of this type to be accepted and not
> generate an error.
>
> Code Snippet:
> ================================================================
>
> boolean success = insertIntoDB(
>          "'" + email + "','" + firstName + "','" + lastName + "','" +
>              telNo + "','" + address1 + "','" + address2 +
>              "','" + county + "','" + country + "','" +
> (String.valueOf(IdNo)) + "','" + password  + "'");
> ================================================================
> End Code:
>
> Ps I tried the archives, but the server is down.....
>
> Thanks again to anyone that may be able to help.
>
> Regards,
> Jennifer
>
> _____________________________________
>
> Get your free E-mail at http://www.ireland.com
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to