Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12

Discussione: Condizione campo vuoto

  1. #1

    Condizione campo vuoto

    Salve,

    vorrei selezionare tutti i record in cui il campo e-mail non è nullo, ma la seguente select mi da errore:

    codice:
    <%
    sql="SELECT * from CLIENT where F_EMAIL<>"""
    set rs=conn.execute(sql)
    %>
    Errore:
    codice:
    Tipo di errore:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][Driver ODBC Microsoft Access] Errore di sintassi nella stringa nell'espressione della query 'F_EMAIL<>"'.
    /sito/cliente/cliente.asp, line 17
    Il campo e-mail è testuale..

    Come risolvere?

    Grazie

  2. #2
    codice:
    <%
    sql="SELECT * from CLIENT where F_EMAIL<>''"
    set rs=conn.execute(sql)
    %>

  3. #3
    Così mi restituisce:

    codice:
    Errore di compilazione di Microsoft VBScript (0x800A0409)
    Costante String senza terminazione
    /sito/cliente/cliente.asp, line 16, column 43
    sql="SELECT * from CLIENT where F_EMAIL<>""

  4. #4
    postami l'istruzione copleta che trovo l'errore

  5. #5
    Scusa ho corretto con i doppi apici:

    codice:
    Tipo di errore:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
    [Microsoft][Driver ODBC Microsoft Access] Parametri insufficienti. Previsto 1.
    /sito/cliente/cliente.asp, line 17

  6. #6
    se mi dai l'intera parte di codice (non tutta la pagina ) capisco meglio dove può essere l'errore (che ti segnala alla riga 17)

  7. #7
    codice:
    <html>
    
    <head>
    <title>Nome</title>
    </head>
    <body>
    
     
    
    <%
    dim voce
    voce=request.QueryString("Voce")
    
    
    if voce="E-mail" then
    sql="SELECT * from CLIENT where F_EMAIL<>''"
    set rs=conn.execute(sql)
    else
    sql="SELECT * from CLIENT where F_CAPCLI=73039 order by F_Ragsoc asc"
    set rs=conn.execute(sql)
    end if
    %>
    
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" height="38">
      <tr>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana">Nome</font></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana">Indirizzo</font></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana">Paese</font></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana">Telefono</font></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana">Cellulare</font></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana">Email</font></td>
      </tr>
      <%
      rs.MoveFirst
      do until rs.EOF
      %>
      <tr>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana"><%response.write(rs.Fields("F_Ragsoc"))%></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana"><%response.write(rs.Fields("F_ViaCli"))%></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana"><%response.write(rs.Fields("F_CittaC"))%></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana"><%response.write(rs.Fields("F_Telefo"))%></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana"><%response.write(rs.Fields("F_Cellul"))%></td>
        <td height="22" style="border-style: solid; border-width: 1; padding: 1"><font size="2" face="Verdana"><%response.write(rs.Fields("F__Email"))%></td>
      </tr>
      <%
      rs.MoveNext
      loop
      %>
    </table>
    
    </body>
    
    </html>

  8. #8
    prova così:

    codice:
    sql="SELECT * FROM CLIENT WHERE F_EMAIL<>''"

  9. #9
    Originariamente inviato da 4everskiff
    prova così:

    codice:
    sql="SELECT * FROM CLIENT WHERE F_EMAIL<>''"
    Nulla..


  10. #10
    Scusami...

    Nel db il campo era scritto erroneamente col doppio underscore:
    Quindi invece di F_EMAIL -> F__EMAIL !!

    Grazie per la pazienza e per l'aiuto!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.