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

Discussione: Record Set

  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2005
    Messaggi
    262

    Record Set

    Ciao,
    mi è venuto un dubbio: se in una tabella non go redord il Rs.RecordCount è = a -1 giusto? ma allora 0 a che equivale?


  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    No, se non ci sono record è 0.

    Roby

  3. #3
    Utente di HTML.it
    Registrato dal
    Jul 2005
    Messaggi
    262
    ma allora come ha fatto con una Response.Write (cstr(Rs.RecordCount) a darmi -1?

  4. #4
    vuol dire che non e' in grado di contare

  5. #5
    Utente di HTML.it L'avatar di Baol74
    Registrato dal
    Jul 2002
    Messaggi
    2,004
    Quando Recordcount è a -1 significa che non hai richiesto (implicitamente) di valorizzare quella proprietà. A seconda dei cursori che usi per l'apertura la proprietà verrà valorizzata.

    http://www.w3schools.com/ado/prop_rs_recordcount.asp

    Stai usando un cursore "forward only"

  6. #6
    Utente di HTML.it
    Registrato dal
    Jul 2005
    Messaggi
    262
    e come faccio a farlo contare?

  7. #7
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Vedendo lo script forse...

    Roby

  8. #8

  9. #9
    Utente di HTML.it
    Registrato dal
    Jul 2005
    Messaggi
    262
    ECCO IL CODICE
    <%
    OpenDataBase()
    'SOLO ADMIN
    if Session("login")=2 then
    Dim dDataCreaz,sDataCorta,sNumOrd,sLogin
    Dim Rs2,Rs3
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Set Rs2 = Server.CreateObject("ADODB.Recordset")
    Set Rs3 = Server.CreateObject("ADODB.Recordset") 'ELENCO DI TUTTI GLI ORDINI
    sSQL="SELECT * from Tab_Ordini order by Ord_DataCreaz desc"
    'Eseguo la Query
    Set Rs = ExecuteSelect(sSQL)
    'Controllo Che ci siano degli Ordini Inseriti
    if Rs.RecordCount<> -1 then
    '----------Ordinamento Colonne---------
    dim ordine
    ordine=request.querystring("ordine")
    sSQL="SELECT * from Tab_Ordini"
    if ordine<>"" then
    sSQL=sSQL&" ORDER BY "&ordine
    'Response.Write (sSQL)
    Set Rs = objConn.Execute(sSQL)
    end if
    '--------------------------------------
    %>
    <P align=center><FONT size=3>Ordini Effettuati</FONT></P>
    <table WIDTH="90%" border="1" bordercolor="#006699">
    <tr>
    <td align=center>Creato Il

    </td>
    <td align=center>Ordine N.ro

    </td>
    <td align=center>Cliente

    </td>
    <td align=center>Stato

    </td>
    <td align=center>Pagamento

    </td>
    </tr>
    <%
    'Setto la variabile di appoggio sApp=0
    Session("sApp")= 0
    Do While NOT Rs.EOF
    '-------Formattazione Data Corta-------
    dDataCreaz=Rs("Ord_DataCreaz")
    'Data gg/mm/aa
    session.LCID = 1040
    sDataCorta=FormatDateTime(dDataCreaz,2)
    'Il 2 corrisponde a vbShortDate
    '--------------------------------------
    'TROVO IL NOME/SOCIETA DA ORD_ID_LOGIN
    sSQL="SELECT * from Tab_Login WHERE ID="&Rs("Ord_ID_Login")
    Set Rs3 = ExecuteSelect(sSQL)
    'Controllo ID con Ord_ID_Login
    if Rs3("id") = Rs("Ord_ID_Login") then
    'Controllo che sia una Società o un Privato
    if Rs3("Log_Societa") <> "." then
    sLogin=Rs3("Log_Societa")
    else
    sLogin=Rs3("Log_Nome")& " " & Rs3("Log_Cognome")
    end if
    end if
    'TROVO IL NUMERO DI ORDINE DEL DETTAGLIO
    sSQL="SELECT * from Tab_Dett_Ordini WHERE Dett_ID_Ordine= "
    sSQL=sSQL & Rs("ID")
    Set Rs2 = ExecuteSelect(sSQL)
    sNumOrd=Rs("Ord_Numero")%>
    <tr>
    <td><%Response.Write(sDataCorta)%></td>
    <td>">N.ro <%=sNumOrd%></td>
    <td><a href="F_Login_Singolo.asp?id=<%=Rs("Ord_ID_Login") %>"><%=sLogin%></td>
    <td><%Response.Write Rs("Ord_Stato")%></td>
    <td><%Response.Write Rs("Ord_Pag")%></td>
    </tr>
    <%
    Rs.MoveNext
    loop
    %>
    </table>

    <%
    Rs.Close
    Rs2.Close
    Rs3.Close
    Set Rs = Nothing
    Set Rs2 = Nothing
    Set Rs3 = Nothing
    CloseDataBase()
    else
    Response.Write("Nessun Ordine Effettuato")
    Rs.Close
    Set Rs = Nothing
    'Chiudo il DB
    CloseDataBase()
    end if
    else
    Response.Write("Utente Non Autorizzato")
    end if%>

    TNKS

  10. #10
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    sSQL="SELECT COUNT(*) from Tab_Ordini" 
    'Eseguo la Query 
    Set Rs = ExecuteSelect(sSQL) 
    tot_rec = Rs(0)
    ...
    ...

    Roby

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.