Visualizzazione dei risultati da 1 a 5 su 5

Discussione: Contare record

  1. #1

    Contare record

    <% sSQL="Select Count(*) as Conta from News Where Tipo= 'Attiva';" %>

    con questa query conto i record della tabella news quando il campo tipo è attiva..ma come stampo a video il risulato??

  2. #2
    Utente di HTML.it L'avatar di Umanista
    Registrato dal
    Jan 2002
    Messaggi
    1,022

    Re: Contare record

    Originariamente inviato da ffilogamo
    <% sSQL="Select Count(*) as Conta from News Where Tipo= 'Attiva';" %>

    con questa query conto i record della tabella news quando il campo tipo è attiva..ma come stampo a video il risulato??
    Response.Write(RS("Conta"))

  3. #3
    ho fatto cosi:


    <% sSQL="Select Count(ID) as Conta from News;"

    objRS.Open sSQL, objConn, 3, 3

    Set objRs = Server.createObject("ADODB.Recordset")
    %>
    <%
    objRs.Open strSQL, objConn
    %>
    <%
    Response.Write("Nel database sono presenti ")
    %>
    <%
    Response.Write(objRs("Conta"))
    Response.Write(" news in totale.")
    %>
    <%
    objRs.Close
    Set objRs = Nothing
    %>

    ma mi da errore

    ADODB.Recordset error '800a0bb9'

    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

    Default.asp, line 140

  4. #4
    Utente di HTML.it L'avatar di fero
    Registrato dal
    Dec 2000
    Messaggi
    265
    codice:
    sSQL="Select Count(ID) as Conta from News" 
    Set objRs = Server.createObject("ADODB.Recordset") 
    objRS.Open sSQL, objConn, 3, 3 
    
    if not objRS.eof then
      Response.Write("Nel database sono presenti " & objRs("Conta") & " news in totale.") ) 
    end if
    objRs.Close 
    Set objRs = Nothing 
    %>
    prova così
    Fero
    Vuoi conoscere nuovi Amici?

  5. #5
    Originariamente inviato da fero
    codice:
    sSQL="Select Count(ID) as Conta from News" 
    Set objRs = Server.createObject("ADODB.Recordset") 
    objRS.Open sSQL, objConn, 3, 3 
    
    if not objRS.eof then
      Response.Write("Nel database sono presenti " & objRs("Conta") & " news in totale.") ) 
    end if
    objRs.Close 
    Set objRs = Nothing 
    %>
    prova così
    VBScript runtime error '800a01a8'

    Object required

    /turismo/default.asp, line 217

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.