|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Hi all,
I need to pass the contents of a text box to an Access database, problem is that the textbox could contain any normal character. What is the escape character so that apostrophies won't cause the end of the string? Cheers Dave |
|
#2
|
|||
|
|||
|
For Microsoft databases, you need to convert single apostrophes to double ones ' '
You can use sql = replace(sql, " ' ", " ' ' ") I added some spaces for readability |
|
#3
|
|||
|
|||
|
Yes!Doug G'anwser is correct!Plz replace the ' to the ''...
|
|
#4
|
||||
|
||||
|
Cheers, but is there an standard rule? Would you always just type the character twice?
The textbox could hold and ASCII character. " ' ", " & ", " % " etc. |
|
#5
|
|||
|
|||
|
Yes,It's SQL statement rule with using "..U can find some knowledge about it in the sql statement guide!...
|
|
#6
|
|||
|
|||
|
Rule for LIKE clauses
To escape special characters in LIKE clauses, the general rule is to enclose the character in [], e.g.[*] and [?].
Example: select * from x where y like "[*]*" will give you all records from table x where the y field starts with an asterisk (*). Kind regards, Jesper Hertel |
|
#7
|
|||
|
|||
|
All LIKE escapes
I guess this must be the necessary escapes for LIKE operator arguments:
[ --> [[] ' --> '' " --> "" ? --> [?] * -->[*] # --> [#] I guess the ']' character does not need escaping, in contrast to the '[' character. /Jesper Last edited by jhertel : November 13th, 2003 at 10:37 AM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > SQL Escape Characters for Access |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|