Re: How can i escape special characters( % [ _ ) in an Access SQL stat



dude! that's what i was looking for.

i can stack them like so if need be:
'%" + tbProduct.Text.Replace("'", "''").Replace("%", "[%]")
..Replace("[", "[[]") + "%'

that works fine for me now...

thanks man....i appreciate your input!


Joe Mayo (C# MVP) wrote:
Hi,

Would doing a myString.Replace("X", "[X]") will work.

Joe
--
http://www.csharp-station.com


"forest demon" wrote:

i need to escape characters, such as ( % and/or _ and/or [ ),
since i have database entries that have such characters in them.

the following piece works fine in an SQL statement (c#), but doesn't
return entries that have one of the above characters in the argument.

... like '%" + tbProduct.Text.Replace("'", "''") + "%' ...

thanks folks...

-¿-



.



Relevant Pages

  • Re: #define on class static member
    ... the number of characters, so I was losing half my text... ... >> Embedding an assignment in anything else should be treated as a coding error. ... >>>Assert a not valid Heap... ... Joseph M. Newcomer [MVP] ...
    (microsoft.public.vc.mfc)
  • Re: German Characters English Windows 2K
    ... "Pegasus (MVP)" wrote: ... attach your own notepad file ... whose characters do not display the way you expect ...
    (microsoft.public.win2000.general)
  • Re: German Characters English Windows 2K
    ... "Pegasus (MVP)" wrote: ... attach your own notepad file ... whose characters do not display the way you expect ...
    (microsoft.public.win2000.general)
  • Re: German Characters English Windows 2K
    ... "Pegasus (MVP)" wrote: ... Could anyone advise as to how I can get German characters ... attach your own notepad file ...
    (microsoft.public.win2000.general)
  • Re: German Characters English Windows 2K
    ... "Pegasus (MVP)" wrote: ... Could anyone advise as to how I can get German characters ... attach your own notepad file ...
    (microsoft.public.win2000.general)