Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it L'avatar di colde
    Registrato dal
    Feb 2001
    Messaggi
    1,802

    Problemi con if su esistenza dati in DB

    Ciao a tutti,
    devo estrarre da un DB un dato che non è sempre presente e inserire il - quando non c'è.

    Le ho provate tutte ma non so piu cosa fare, ho fatto il controllo su rs.EOF = true o false
    ho fatto un altro controllo per leggere il risultato della variabile associata al dato estratto, ho inserito il controllo con IsNull, con "" e poi non ricordo..insomma ho esaurito le idee.

    La tabella da dove si estrae il dato è popolata soltanto che non c'è il dato richiesto.

    Questo è il codice:


    Set rssrif = Server.CreateObject("ADODB.Recordset")

    With rssrif
    .LockType = 3
    .CursorType = 3
    .CursorLocation = 3
    .ActiveConnection = conn
    .Open "select IDstrutture from rifstrutture where IDtrattamento = '"&Cint(IDtrattamento)&"'"
    End With

    Do while NOT Rssrif.EOF

    IDstrutture = rssrif("IDstrutture")


    if IDstrutture <> "" OR rssrif.EOF = false then
    n = 0

    Set rss = Server.CreateObject("ADODB.Recordset")

    With rss
    .LockType = 3
    .CursorType = 3
    .CursorLocation = 3
    .ActiveConnection = conn
    .Open "select struttura from strutture where IDstruttura = '"&Cint(IDstrutture)&"'"
    End With

    Do while NOT Rss.EOF

    struttura = rss("struttura")
    %>
    <%=struttura&";
    "%>
    <%
    n = n+1
    RSs.MoveNext
    Loop
    'if IsRss.EOF) then
    response.Write(RSs.EOF)
    'end if

    Rss.Close
    Set Rss = Nothing
    else
    response.Write("-")
    end if
    RSsrif.MoveNext
    Loop
    Rssrif.Close
    Set Rssrif = Nothing

    Potete aiutarmi? Grazie

    www.beppegrillo.it
    Il blog di Beppe!!

  2. #2
    Utente di HTML.it L'avatar di Sypher
    Registrato dal
    Jun 2003
    Messaggi
    1,994
    non so se ho capito bene...ma se il dato non c'è esce dal ciclo e non fa un piffero...io metterei il controllo if rs.EOF o if rs.recordcount = 0 fuori dal ciclo per cominciare
    La passera non dura perchè Sypher la cattura!

    "No one like us we don't care, we are millwall, super millwall, we are millwall from the DEN"

  3. #3
    Utente di HTML.it L'avatar di colde
    Registrato dal
    Feb 2001
    Messaggi
    1,802
    Ok, ora funge. Grazie!

    www.beppegrillo.it
    Il blog di Beppe!!

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.