Variable avec un apostrophe en SQL
Bonjours à tous,
Dans un code comme celui-ci, comment faire pour que ma requete fonctionne si dans ma variable il y a un apostrophe ? Par exemple, ma variable (SW_SERIE) est égale à (L'instit). Faut il mettre plusieurs doubles cotes ?
Merci par avance pour votre aide.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| NEW_FILTRE = "SELECT T_FILMS.NO_ENREGISTREMENT, T_FILMS.F_GENRE, T_FILMS.F_SERIE, T_FILMS.F_TITRE, T_FILMS.F_CLASSEUR FROM T_FILMS"
WAND = " WHERE"
If Not IsNull(SW_SERIE) And SW_SERIE <> "" Then
NEW_FILTRE = NEW_FILTRE + WAND
NEW_FILTRE = NEW_FILTRE + " "
NEW_FILTRE = NEW_FILTRE + "T_FILMS.F_SERIE Like '" & SW_SERIE & "'"
WAND = " AND"
End If
If Not IsNull(SW_GENRE) And SW_GENRE <> "" Then
NEW_FILTRE = NEW_FILTRE + WAND
NEW_FILTRE = NEW_FILTRE + " "
NEW_FILTRE = NEW_FILTRE + "T_FILMS.F_GENRE Like '" & SW_GENRE & "'"
WAND = " AND"
End If
NEW_FILTRE = "SELECT T_FILMS.NO_ENREGISTREMENT, T_FILMS.F_GENRE, T_FILMS.F_SERIE, T_FILMS.F_TITRE, T_FILMS.F_CLASSEUR FROM T_FILMS"
Me.RecordSource = NEW_FILTRE + ";"
Me.Requery |