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

    Problema con visualizzazione pagina

    Salve a tutti, ho scritto questo codice, per visualizzare le news in una pagina, ma quando vado ad eseguire l'anteprima, la pagina è tutta bianca, e non visualizza nulla. Ma non riscontra nessun errore.
    Che può essere??
    Ecco il codice:
    codice:
    <%@LANGUAGE="VBSCRIPT"%>
    <%
    Set conn = Server.CreateObject("ADODB.Connection")
    StrConnect = "Provider = Microsoft.JET.OLEDB.4.0; Data Source = "&Server.MapPath("_private/database/news.mdb")&"; Persist Security Info = False"
    conn.open(StrConnect)
    %>
    <%
    sql = "SELECT * FROM news order by data_news"
    Set rs = Server.CreateObject("ADODB.Recordset")
    Set rs = conn.execute(sql)
    %>
    <%
    id=1
    Do While rs.EOF
    	if id>7	then
    		Exit Do
    	end if
    %>
    <html>
    <head>
    <title>News</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#00FFFF" text="#330000">
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    	<tr>
    		<td>
    			<h1>NEWS:</h1>
    		</td>
    		<td>
    			<%=rs("titolo_news")%>
    		</td>
    	</tr>
    </table>
    </body>
    </html>
    <%
    id = id+1
    rs.movenext
    loop
    %>
    <%
    Set rs = Nothing
    %>
    <%
    conn.close
    Set conn = Nothing
    %>
    Aiutatemi Grazie!!

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    7 pagine in 1!
    Il loop lo devi mettere DOPO il <body>

    e così
    id = id+1
    rs.movenext
    loop

    PRIMA del </body>.

    Roby

  3. #3
    Ho fatto come hai detto tu, ma ora viene visualizzato solo il colore di sfondo.

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

    Roby

  5. #5
    Eccolo che arriva
    codice:
    <%@LANGUAGE="VBSCRIPT"%>
    <%
    Set conn = Server.CreateObject("ADODB.Connection")
    StrConnect = "Provider = Microsoft.JET.OLEDB.4.0; Data Source = "&Server.MapPath("_private/database/news.mdb")&"; Persist Security Info = False"
    conn.open(StrConnect)
    %>
    <%
    sql = "SELECT * FROM news order by data_news"
    Set rs = Server.CreateObject("ADODB.Recordset")
    Set rs = conn.execute(sql)
    %>
    <html>
    <head>
    <title>News</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#00FFFF" text="#000000">
    <%
    id=1
    Do While rs.EOF
    	if id>7	then
    		Exit Do
    	end if
    %>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    	<tr>
    		<td>
    			<h1>NEWS:</h1>
    		</td>
    	</tr>
    	<tr>
    		<td>
    			
    			<%=rs("titolo_news")%>
    		</td>
    	</tr>
    </table>
    <%
    id = id+1
    rs.movenext
    loop
    %>
    </body>
    </html>
    <%
    Set rs = Nothing
    %>
    <%
    conn.close
    Set conn = Nothing
    %>

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    Do While not rs.EOF
    Roby

  7. #7
    OPPPSSSS!!
    Grazie 1000,
    Ora si che va

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.