Question sur les requêtes paramétrées
Bonjour tout le monde.
Ptite question sur les requêtes paramétrées:
Quand je cherche à faire une requête du genre SELECT * FROM maTable WHERE id = xxx, je fais:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Dim cmdGetCategory As DbCommand = dbFactory.CreateCommand
With cmdGetCategory
.Connection = cnxBPMI_READ
.CommandText = "SELECT * FROM maTable WHERE id = ?"
Dim IdParam As DbParameter = dbFactory.CreateParameter
With IdParam
.ParameterName = "@id"
.DbType = DbType.Int32
.Value = _id
End With
.Parameters.Add(IdParam)
End With |
Comment faire avec des requêtes comme:
SELECT * FROM maTable WHERE libelle LIKE '%toto%'
ou
SELECT * FROM maTable WHERE id IN (12, 458, 1269)
Merci