EXPERTISE,
CONSEILS, FORMATION,
ACCOMPAGNEMENT AU CHANGEMENT Solution Intranet, Extranet et Internet Accompagnement et formation au travail collaboratif Accès à la
rubrique
Formation
FORMATION
SALARIES ETUDIANTS APPRENTIS. Bureautique, Internet, Sciences de la vie, Mathématique, Physiques Aéronautique Accès à
la rubrique
Biologie
RECHERCHE
Biologie cellulaire Biologie moléculaire Génétique Accès à la
rubrique
Aéronautique
PILOTE
PRIVE D'AVION Enseignant
- aéronautique
- aéromodélisme en savoir plus
Créer une chexbox dynamique
<%
Dim
p
p=0
Set statRes = SQLQuery(adoCon, "SELECT * From ANO_status
WHERE status_id > 0 ORDER BY status_id ASC")
If Not statRes.EOF Then
Do While Not statRes.EOF
%>
<font face="Verdana, Arial, Helvetica, sans-serif"
size="1">
<% = statRes("sname")%>
</font>
<input type="checkbox" name="<%response.write("status"&p)%>"
value="<%
= statRes("status_id")%>">
<br>
<%
p=p+1
statRes.MoveNext
Loop
End If
statRes.Close
%>
Dim status()
For p = 0 to tour
Redim Preserve status(p+1)
status(p) = Request.Form("status"
& p)
Next
%>
POUR
LA REQUETTE
Dim
m
m=0
For p=0 to tour
if status(p)>0 and m=0 then
whereStr = whereStr & "AND("
m=m+1
end if
NEXT
La
construction de la parenthèse
dim
n
n=0
For p=0 to tour
If status(p) <> 0 Then
If status(p) > 0 Then
whereStr = whereStr
& "p.status= "& status(p)&"OR "
Else
whereStr = whereStr & " AND
p.status<>" & Cfg(adoCon, "CloseStatus")
End If
End if
NEXT
if
Mid (whereStr , Len(whereStr)-2,3) = "OR "
then
whereStr = Mid (whereStr , 1 , Len(whereStr) -3)
end if
La
construction de la requette.
Ce
sont des OR qui s'ajoute à chaque tour.
Le
dernier OR doit être effacé
Mid
: Renvoir
un nombre de caractères dans une chaîne
à partir de la position spécifiée.
Je
prend la chaîne whereStr de 1 jusqu'à son
nombre de caractère et j'enlève 3.
J'ai donc ma chaîne avec trois caractère
en moins.
Uniquement
si la chaîne se termine par OR
Dim
q
q=0
for p=0 to tour
if status(p)>0 and q= 0 then
whereStr = whereStr & ")"
q=q+1
end if
next
La
construction de la dernière parenthèse
RESULTAT
de la requette pour cette partie
En
fonction de ce qui a été coché
AND(p.status=
1 OR p.status= 2 OR p.status= 3 OR p.status= 4 OR p.status=
100)
AND(p.status= 1)
AND(p.status= 1 OR p.status= 100)