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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
* "=?Utf-8?B?Qm9iIEU=?= said:
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?

Try "\'" or "''".
 
Hi Bob,

I have had no trouble appending a row, and the assigning a value:

irow("lname") = irow_("lname")

The assigned value comes from the 'other' table. What am I missing here?

Bernie Yaeger

Bob E said:
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?
 
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 said:
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?
 
Back
Top