IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP Discussion :

Problème de conditions


Sujet :

ASP

  1. #21
    Membre confirmé Avatar de Phiss
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2005
    Messages
    676
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2005
    Messages : 676
    Points : 616
    Points
    616
    Par défaut
    Tu peux nous remettre ton code...
    Celui que tu as maintenant.

  2. #22
    Membre régulier Avatar de vanou
    Profil pro
    Étudiant
    Inscrit en
    Mai 2006
    Messages
    160
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2006
    Messages : 160
    Points : 110
    Points
    110
    Par défaut
    voici mon code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    <html>
     
    <head>
    <title>Liste des PCs avec leurs logiciels</title>
    <link rel="stylesheet" type="text/css" href="/Web000/YFR-ROT-ARC.css">
    <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta name="Microsoft Border" content="tlb, default">
    </head>
     
    <body>
    <form>
    <input type=button name=imprimer value=Imprimer onclick="window.print();">
    </form>
    <%
    dim pc, util
    pc=request.form("txtFR")
    util=request.form("txtU")
    set rs=Server.CreateObject("ADODB.Recordset")
    varSQL = "SELECT computers.computer_name" & _ 	
    	",software_name" & _
    	" FROM computers LEFT JOIN software ON computers.computer_name = software.computer_name" & _
    	" LEFT JOIN local_users ON computers.computer_name = local_users.computer_name"&_
      	" WHERE software.software_name not like 'Correctif%'"&_
    	" AND software.software_name not like 'Security Update%'"&_
    	" AND software.software_name not like 'Mise à jour%'"&_
    	" AND software.software_name not like 'Update for Windows%'"&_
    	" AND software.software_name not like '%Hotfix %'"&_
      	" AND software.software_name not like 'Aggiornamento%'"&_
      	" AND computers.operating_system_name not like '%Server'" 	
     
    if pc<>"" then
           varSQL  = varSQL  &  "AND computers.computer_name='" & pc & "'" & _	
           	"group by computers.computer_name,software.software_name"&_
           ";"
    end if
     
    if util<>"" then
           varSQL  = varSQL  &  "AND local_users.user_name='" & util & "'" & _	
           "group by computers.computer_name,software.software_name"&_
           ";"
    end if	
     
    if pc<>"" and pc<>"" then
    	   varSQL  = varSQL  &  "AND local_users.user_name='" & util & "'" AND computers.computer_name='" & pc & "'"& _	
           "group by computers.computer_name,software.software_name"&_
           ";"
    end if
     
    rs.open varSQL, "Provider=SQLOLEDB.1;Password=sqlinfo;Persist Security Info=True;User ID=info;Initial Catalog=york_tn;Data Source=FRCARFS13"
    	response.write "<table border bordercolor=#000000 cellpadding=2>"
    	response.write"<tr>"
    	response.write"<th>Nom du PC</th>"
    	response.write"<th>Logiciel</th>"
    	response.write"</tr>"
     
    do while not rs.eof
    	response.write "<tr align=center>"
    	response.write "<td>"
    	response.write rs("computer_name")
    	response.write"</td>"	
    	response.write "<td>"
    	response.write rs("software_name")
    	response.write"</td>"
    	response.write "</tr>"
    	rs.MoveNext	
    loop
    response.write "</table>"
    rs.close
     
    response.write date()
    %>
    </body></html>
    l'erreur que ca m'affiche

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    Erreur de compilation Microsoft VBScript error '800a03ea' 
     
    Erreur de syntaxe 
     
    /Web005/YFR-IN2-0250.asp, line 90 
     
    varSQL  = varSQL  &  "AND local_users.user_name='" & util & "'" AND computers.computer_name='" & pc & "'"& _
    --------------------------------------------------------------------------------------------^
    de plus le response.write varSQL que j'ai mis tte a lheure pour bien montrer que se troisieme "if" tient en compte des deux précédents

  3. #23
    Membre régulier Avatar de vanou
    Profil pro
    Étudiant
    Inscrit en
    Mai 2006
    Messages
    160
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2006
    Messages : 160
    Points : 110
    Points
    110
    Par défaut
    Merci à vous tous pour votre aide ma foi bien precieuse


  4. #24
    Membre confirmé Avatar de Phiss
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2005
    Messages
    676
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2005
    Messages : 676
    Points : 616
    Points
    616
    Par défaut
    J'ai mis en gras ce que tu avais a modifier.
    Il y a aussi

    Citation Envoyé par vanou
    voici mon code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    29
    30
    31
    32
    33
    34
    35
    36
    37
    <%
    dim pc, util
    pc=request.form("txtFR")
    util=request.form("txtU")
    set rs=Server.CreateObject("ADODB.Recordset")
    varSQL = "SELECT computers.computer_name" & _ 	
    	",software_name" & _
    	" FROM computers LEFT JOIN software ON computers.computer_name = software.computer_name" & _
    	" LEFT JOIN local_users ON computers.computer_name = local_users.computer_name"&_
      	" WHERE software.software_name not like 'Correctif%'"&_
    	" AND software.software_name not like 'Security Update%'"&_
    	" AND software.software_name not like 'Mise à jour%'"&_
    	" AND software.software_name not like 'Update for Windows%'"&_
    	" AND software.software_name not like '%Hotfix %'"&_
      	" AND software.software_name not like 'Aggiornamento%'"&_
      	" AND computers.operating_system_name not like '%Server'" 	
    
    if pc<>"" and util = ""then
           varSQL  = varSQL  &  "AND computers.computer_name='" & pc & "'" & _	
           	"group by computers.computer_name,software.software_name"&_
           ";"
    end if
     	
    if util<>"" and pc= ""then
           varSQL  = varSQL  &  "AND local_users.user_name='" & util & "'" & _	
           "group by computers.computer_name,software.software_name"&_
           ";"
    end if	
    
    if pc<>"" and util<>"" then
    	   varSQL  = varSQL  &  "AND local_users.user_name='" & util & "' AND  computers.computer_name='" & pc & "'"& _	
           "group by computers.computer_name,software.software_name"&_
           ";"
    end if
    	
    %>
    </body></html>

  5. #25
    Membre régulier Avatar de vanou
    Profil pro
    Étudiant
    Inscrit en
    Mai 2006
    Messages
    160
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2006
    Messages : 160
    Points : 110
    Points
    110
    Par défaut
    merci bcp pour ton aide

    J'ai fais comme ca et ca marche aussi

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    if pc="" then
           varSQL  = varSQL  &  "AND local_users.user_name='" & util & "'" & _	
           	"group by computers.computer_name,software.software_name"&_
           ";"
    end if
     
    if util="" then
           varSQL  = varSQL  &  "AND computers.computer_name='" & pc & "'" & _	
           "group by computers.computer_name,software.software_name"&_
           ";"
    end if	
     
    if pc<>"" and util<>"" then
    	  varSQL  = varSQL  &  "AND local_users.user_name='" & util & "' AND computers.computer_name='" & pc & "'"&_ 
    	  "group by computers.computer_name,software.software_name"&_
    	";"
    end if
    bye bye

  6. #26
    Membre confirmé Avatar de Phiss
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2005
    Messages
    676
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2005
    Messages : 676
    Points : 616
    Points
    616
    Par défaut
    Et si pc et util sont vide cela donne quoi avec ton code?

  7. #27
    Membre régulier Avatar de vanou
    Profil pro
    Étudiant
    Inscrit en
    Mai 2006
    Messages
    160
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2006
    Messages : 160
    Points : 110
    Points
    110
    Par défaut
    quand les deux sont vide j'ai mis une alert

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 2 PremièrePremière 12

Discussions similaires

  1. [débutant] problème de condition dans une requete
    Par banker dans le forum Access
    Réponses: 5
    Dernier message: 22/03/2006, 13h52
  2. Réponses: 7
    Dernier message: 27/02/2006, 18h04
  3. [Debutant]Problème de condition
    Par ghan77 dans le forum Langage
    Réponses: 9
    Dernier message: 13/12/2005, 15h20
  4. Problème de condition, je flanche..
    Par KibitO dans le forum Langage
    Réponses: 13
    Dernier message: 11/11/2005, 12h57
  5. Réponses: 6
    Dernier message: 17/08/2005, 12h38

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo