View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KS Wong[_2_] KS Wong[_2_] is offline
external usenet poster
 
Posts: 13
Default How to deal with the character ' in a SQL string

Dear all,

Please give me some hints to tackle the following problem: -

strSQL = "Select location from restaurant where name = '" & strName & "'"
rstResult.open strsql, adoconnection, adOpenKeyset, adLockOptimistic

** if the string variable strName contains the character ['], i.e.
Benjimin's Restaurant, then error occurs.

Thanks in advance!

Keith