Visualizzazione dei risultati da 1 a 6 su 6
  1. #1

    Either BOF or EOF is True

    Come posso evitare che se il rs è vuoto mi scrive "nessun dato" invece di adarni l'werrore


    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

    LINK

    <%
    regione=request("regione")
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.ConnectionString = cn
    objConn.Open
    sql="select * from centenarie where regione LIKE '"& request("regione") & "' ORDER BY nome ASC"
    set objRec=server.CreateObject("ADODB.recordset")
    objRec.Open sql, objConn,3,3
    recordsperpage=20
    objRec.pagesize=recordsperpage
    Pages=request.querystring("pagina")
    if (len (Pages)>0 and isnumeric(Pages)) then
    Pages=clng(Pages)
    else
    Pages=1
    end if
    %>

  2. #2
    Codice PHP:
    If rs.EOF and rs.BOF then
    Response
    .Write("Nessun dato presente...")
    Else 
    ' Altrimenti non è vuoto e fai questo
    ...........................
    End if 

  3. #3
    Dopo aver aperto il recordset controlla che non sia vuoto.
    Così:

    codice:
    if not objRec.EOF then
    [tuocodice]
    end if
    Sono fermamente convinto che sia possibile fare ogni cosa. Tutto sta a capire come.

  4. #4
    Gentilissimo, solo che non capisco dome aggiunegere questi controlli ti scrivo il codice dell pagina intera:

    [CODE]

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>UNASCI - Societ&agrave; Centenarie</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="javascript" src="/include/inc_credits.js"></script>
    <link href="stili.css" rel="stylesheet" type="text/css">
    <!--[if gte IE 5.5]>
    <script language="JavaScript" src="dhtml.js" type="text/JavaScript"></script>
    <![endif]-->
    </head>
    <body>
    <div style="display:none"><script type="text/javascript" language="JavaScript" src="http://www.unasci.it/myasg/stats_js.asp"></script> ;</div>
    <table width="791" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    <tr>
    <td background="images/unasci_r4_c1.png"></td>
    <td height="30" colspan="8" bgcolor="#FFFFFF"><div align="right"><span class="testo">Utenti on-line: <%= Application("ActiveUsers") %></span> </div></td>
    <td background="images/unasci_r4_c10.png"></td>
    <td></td>
    </tr>
    <tr>
    <td background="images/unasci_r4_c1.png"></td>
    <td colspan="7" bgcolor="#004D80"></td>
    <td bgcolor="#004D80"><div align="right">
    <%
    IF Session("Autenticato") = False then
    Response.Write ""
    else
    Response.Write "[img][/img]"
    End if
    %>
    </div></td>
    <td background="images/unasci_r4_c10.png"></td>
    <td></td>
    </tr>
    <tr>
    <td background="images/unasci_r4_c1.png"></td>
    <td colspan="8">[img]/images/9.jpg[/img]</td>
    <td>[img]images/unasci_r4_c10.png[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    <tr>
    <td colspan="10" rowspan="2" valign="top" background="images/spacer.png"><table width="765" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td width="250" valign="top" bgcolor="#F3F3F3"><table width="92%" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td><table width="250" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td bgcolor="#F3F3F3">[img]images/eventi_barra.png[/img]</td>
    </tr>
    <tr>
    <td></td>
    </tr>

    <tr>
    <td width="246">[img]images/area_barra.png[/img]</td>
    </tr>
    <tr valign="top">
    <td></td>
    </tr>
    <tr valign="top">
    <td>[img]images/ricerca_barra.png[/img]</td>
    </tr>
    <tr valign="top">
    <td></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    <td valign="top"><table width="500" border="0" align="center" cellpadding="0" cellspacing="2">
    <tr>
    <td height="30" colspan="2"></td>
    </tr>
    <tr>
    <td colspan="2"><span class="titoli"> Censimento delle Societ&agrave; Sportive Centenarie d'Italia</span></td>
    </tr>
    <tr>
    <td width="49%" valign="top" class="testo">
    <%
    regione=request("regione")
    Set objConn = Server.CreateObject("ADODB.Connection")
    Dim objConn
    objConn.ConnectionString = cn
    objConn.Open
    Dim sql
    sql="select * from centenarie"
    set objRec=server.CreateObject("ADODB.recordset")
    objRec.Open sql, objConn,3,3
    recordsperpage=20
    objRec.pagesize=recordsperpage
    Pages=request.querystring("pagina")
    if (len (Pages)>0 and isnumeric(Pages)) then
    Pages=clng(Pages)
    else
    Pages=1
    end if
    %>
    L'UNASCI&egrave; l'unica organizzazione in Italia che pubblicae curaun censimento delle societ&agrave; sportive centenarie del nostro paese.



    L'elenco che oggi contiene <%=objRec.recordcount%> societ&agrave; centenarie - di cui un quarto circaSociUNASCI-pu&ograve; essere liberamente pubblicatoda chiunque (ad esempio, organi di stampa),citando la fonte UNASCIed informando all'emailinfo@unasci.it preventivamente l'UNASCIin merito all'utilizzo dell'elenco stesso.



    Se hai una societ&agrave; centenaria da segnalareo correzioni su dati del censimento (ad esempio, anno di fondazione di una societ&agraveinviaci un messaggio.</td>
    <td width="51%" align="center" class="testo">[img]images/cartina_italia.jpg[/img]</td>
    </tr>

    <tr>
    <td colspan="2"><span class="testo">
    <%
    regione=request("regione")
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.ConnectionString = cn
    objConn.Open
    sql="select * from centenarie where regione LIKE '"& request("regione") & "' ORDER BY nome ASC"
    'sql="select * from centenarie where regione LIKE '"& request("regione") & "' ORDER BY nome ASC"
    set objRec=server.CreateObject("ADODB.recordset")
    objRec.Open sql, objConn,3,3
    recordsperpage=20
    objRec.pagesize=recordsperpage
    Pages=request.querystring("pagina")
    if (len (Pages)>0 and isnumeric(Pages)) then
    Pages=clng(Pages)
    else
    Pages=1
    end if

    %>
    Pagina <%=pages%> di <%=objRec.pagecount%></span></td>
    </tr>
    <tr>
    <td colspan="2"><h1><%=objRec("regione")%> (<%=objRec.recordcount%>)</h1></td>
    </tr>
    <tr>
    <td height="95" colspan="2"><span class="testo">
    <%
    if not objRec.eof then
    objRec.pagesize=recordsperpage
    objRec.absolutepage=Pages
    'qui inserisce le pagine
    response.write "<div align='left'>"
    for i=1 to objRec.pagecount
    if i=1 then response.write ""
    if i=Pages then
    response.write "("&i&") "
    else
    response.Write(""&i&" ")
    end if
    next
    response.write "</div>"
    'fine pagine
    for x=1 to recordsperpage
    if not objRec.eof then
    %>
    </span>

    <table width="496" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="428"><span class="testo"><%=objRec("anno")%> -
    <%response.write "" & objRec("nome") & ""%>
    <%
    if isNull(objRec("affiliata"))=true or len(Trim(objRec("affiliata")))<2 then
    Response.write("<span class=""avviso"">[affiliata]</span>")
    Else
    Response.write("")
    end if
    %>
    - <%=objRec("citta")%> (<%=objRec("provincia")%>)</span></td>
    </tr>
    </table>
    <%
    end if
    if not objRec.EOF then objRec.movenext
    next
    set objRec=nothing
    set objconn=nothing
    end if
    %></td>
    </tr>
    <tr>
    <td colspan="2"><div align="right">torna su</div></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    <tr>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    <tr>
    <td colspan="10">[img]images/unasci_r7_c1.png[/img]</td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    <tr>
    <td colspan="10" valign="top"><div align="right">

    </div></td>
    <td>[img]images/spacer.gif[/img]</td>
    </tr>
    </table>

    <map name="Map">
    <area shape="poly" coords="53,66,59,75,61,86,65,101,74,110,80,102,88, 89,87,77,70,70" href="centenarie.asp?regione=Toscana">
    <area shape="poly" coords="49,46,45,54,55,65,69,67,78,72,87,75,98,75, 92,65,93,53" href="centenarie.asp?regione=Emilia Romagna">
    <area shape="poly" coords="100,78,111,86,113,100,107,106,102,98,100,9 0,90,85,89,75" href="centenarie.asp?regione=Marche">
    <area shape="poly" coords="105,16,115,18,117,27,114,35,102,36,95,30,9 9,18" href="centenarie.asp?regione=Friuli Venezia Giulia">
    <area shape="poly" coords="100,13,86,20,84,26,77,32,71,34,68,41,79,49 ,91,52,95,41,100,38,94,28" href="centenarie.asp?regione=Veneto">
    <area shape="poly" coords="38,131,43,149,41,159,37,180,29,179,25,184, 17,176,21,164,20,146,18,138,25,142" href="centenarie.asp?regione=Sardegna">
    <area shape="poly" coords="61,13,56,20,51,15,44,26,40,22,35,28,40,37, 34,38,34,43,44,53,50,45,76,50,68,39,72,31,68,25,69 ,20" href="centenarie.asp?regione=Lombardia">
    <area shape="poly" coords="51,68,37,61,27,67,25,73,16,72,18,65,24,65, 28,56,45,55,51,62" href="centenarie.asp?regione=Liguria">
    <area shape="poly" coords="37,17,38,24,33,26,38,37,32,37,34,46,44,53, 35,56,27,56,24,64,14,61,7,58,9,47,6,43,14,35,24,36 ,26,29,28,20" href="centenarie.asp?regione=Piemonte">
    <area shape="poly" coords="70,4,65,12,70,16,70,25,72,32,81,29,91,16,9 7,13,95,8,93,3" href="centenarie.asp?regione=Trentino Alto Adige">
    <area shape="poly" coords="91,86,88,93,85,99,83,99,93,111,109,106,101 ,98,101,90" href="centenarie.asp?regione=Umbria">
    <area shape="poly" coords="84,101,95,111,102,109,103,120,117,127,116, 135,112,140,102,136,87,125,76,111" href="centenarie.asp?regione=Lazio">
    <area shape="poly" coords="119,133,128,135,135,136,143,142,141,151,14 6,164,135,165,130,156,122,149,114,150,115,141" href="centenarie.asp?regione=Campania">
    <area shape="poly" coords="140,208,130,211,123,213,106,213,97,208,89, 210,87,220,98,223,115,232,124,241,134,240,133,228" href="centenarie.asp?regione=Sicilia">
    <area shape="poly" coords="145,168,152,179,152,188,154,193,149,197,14 5,205,145,214,152,210,160,200,163,195,167,189,168, 181,159,176,160,167,155,169" href="centenarie.asp?regione=Calabria">
    <area shape="poly" coords="138,124,146,125,155,125,151,130,153,136,16 8,144,184,152,192,163,188,172,184,164,175,160,166, 158,156,147,145,142,136,135" href="centenarie.asp?regione=Puglia">
    <area shape="poly" coords="22,22,19,26,15,23,10,25,12,33,24,34,27,28, 25,24" href="centenarie.asp?regione=Valle Aosta">
    <area shape="poly" coords="114,101,121,111,129,119,124,123,122,120,11 8,126,103,121,104,109" href="centenarie.asp?regione=Abruzzo">
    <area shape="poly" coords="131,120,136,125,136,133,129,134,124,133,11 8,134,118,126" href="centenarie.asp?regione=Molise">
    <area shape="poly" coords="146,142,157,147,165,158,160,168,146,169,14 7,159,141,151" href="centenarie.asp?regione=Basilicata">
    </map></body>
    </html>

  5. #5

  6. #6
    scusa lo scrivo meglio...
    codice:
    <td colspan="2"><span class="testo">
                  <% 
    	regione=request("regione")
    	Set objConn = Server.CreateObject("ADODB.Connection")
    	objConn.ConnectionString = cn
    	objConn.Open
    	sql="select * from centenarie where regione LIKE '"& request("regione") & "' ORDER BY nome ASC"
    	'sql="select * from centenarie where regione LIKE '"& request("regione") & "' ORDER BY nome ASC"
    	set objRec=server.CreateObject("ADODB.recordset")
    	objRec.Open sql, objConn,3,3
    	recordsperpage=20
    	objRec.pagesize=recordsperpage
    	Pages=request.querystring("pagina")
    	if (len (Pages)>0 and isnumeric(Pages)) then
    	Pages=clng(Pages)
    	else
    	Pages=1
    	end if
    	
    %>
                  Pagina <%=pages%> di <%=objRec.pagecount%></span></td>
              </tr>
              <tr>
                <td colspan="2"><h1><%=objRec("regione")%> (<%=objRec.recordcount%>)</h1></td>
              </tr>
              <tr>
                <td height="95" colspan="2"><span class="testo">
                  <%	
        if not objRec.eof then
    	objRec.pagesize=recordsperpage
    	objRec.absolutepage=Pages
    	'qui inserisce le pagine
    	response.write "<div align='left'>"
    	for i=1 to objRec.pagecount
    	if i=1 then response.write ""
    	if i=Pages then
    	response.write "("&i&") "
    	else
    	response.Write(""&i&" ")
    	end if
    	next
    	response.write "</div>"
    	'fine pagine
    	for x=1 to recordsperpage
    	if not objRec.eof then
    %>
                  </span>
    
                  <table width="496"  border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="428"><span class="testo"><%=objRec("anno")%> - 
                      <%response.write "" & objRec("nome") & ""%>
    <%
    if isNull(objRec("affiliata"))=true or len(Trim(objRec("affiliata")))<2 then
    Response.write("<span class=""avviso"">[affiliata]</span>")
    Else
    Response.write("")
    end if
    %> 
                      - <%=objRec("citta")%> (<%=objRec("provincia")%>)</span></td>
                    </tr>
                  </table>
                  <%
    	end if
    	if not objRec.EOF then objRec.movenext
    	next
    	set objRec=nothing
    	set objconn=nothing 
        end if
    %></td>

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.