Re: Entering single quote into a database expl (O'Hare)

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Trev Hunter (hunter_trev_at_hotmail.com)
Date: 02/15/04


Date: Sun, 15 Feb 2004 20:15:00 -0000

Bob,

If you're running SQL statements like:

"INSERT INTO Users (Name, Address) values ('" & szName & "','" & szAddress &
"')"

consider using parameters instead. They should handle all the problems with
single quotes, number and date formats etc.

Your SQL statement would change to:
"INSERT INTO Users (Name, Address) values (?,?)"

and add the parameters in the proper order to the parameters collection of
the command object.

You may find more help by posting in
microsoft.public.dotnet.framework.adonet

HTH,

Trev.

"Bob E" <anonymous@discussions.microsoft.com> wrote in message
news:4533342C-C176-496A-AEE7-3F266A57D521@microsoft.com...
> How can I insert a field name like O'Hare or O'Conner into a table. I
would rather not have to check every field entered to see if the character
( ' ) is in the field. I'm entering Streets, Names, Clients, etc. into a
table. Everything was going fine until the Name field (O'Hare) was entered.
Can I somehow map the Chr$(39) to Chr$ (96)? Any suggestions?



Relevant Pages

  • Re: Escaping charactors in SQL
    ... Tibor is correct that you can replace the single quotes with Doubles and in ... > I'm having problems with some charactors in SQL statements. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Escaping charactors in SQL
    ... Tibor is correct that you can replace the single quotes with Doubles and in ... > I'm having problems with some charactors in SQL statements. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Escaping charactors in SQL
    ... Tibor is correct that you can replace the single quotes with Doubles and in ... > I'm having problems with some charactors in SQL statements. ...
    (microsoft.public.sqlserver.programming)
  • Re: US vs UK date format
    ... International Date Formats in Access ... The article explains that literal dates in VBA and SQL statements are ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.forms)