ciao sto creando un pagina in asp solo che mi da un errore strano
Tipo di errore:
Errore di run-time di Microsoft VBScript (0x800A01A8)
Necessario oggetto: 'conn'
/nuovacartella/guestbook.asp, line 30
sapete spiegarmi come posso fare per rimediare a quest'errore?
vi posto il codice della pagina
<html>
<head>
<title>MIO GUESTBOOK</title>
</head>
<body>
<p align="center"><font size="4" face="Verdana">Messaggi_GuestBook</font></p>
<%
'NUMERO DI MESSAGGI PER PAGINA
iPageSize = 5
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
If Request.QueryString("order") = "" Then
strOrderBy = "id"
Else
strOrderBy = Request.QueryString("order")
End If
'PERCORSO DEL DATABASE
url_DB = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("/mdb-database/database.mdb")
SetConn = Server.CreateObject("ADODB.Connection")
conn.Open url_DB
Set RS = Server.CreateObject("ADODB.Recordset")
'FA LA RICHESTA AL DATABASE
sql = "SELECT * FROM GuestBook_Messaggi ORDER BY " & strOrderBy & " DESC;"
RS.Open sql, conn.adOpenKeyset
RS.PageSize
RS.CacheSize = iPageSize
iPageCount = RS.PageCount
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
'NESSUN MESSAGGIO INSERITO -> VIENE VISUALIZZATO UN MESSAGGIO CHE INFORMA CHE NON E' PRESENTE
'NEMMENO UN MESSAGGIO NEL GUESTBOOK
If iPageCount = 0 Then
%><hr>
<p align="center"><font size="2" face="Verdana">Nessunmessaggio inserito nel guestbook!</font></p>
<hr>
<%
Else
RS.AbsolutePage = iPageCurrent
iRecordsShown = 0
' SE I MASSAGGI SONO PRESENTI NEL GUESTBOOK, LI MOSTRA
Do While eRecordsShown < iPageSize And Not RS.EOF%>
<hr>
<table border="0" cellpadding="0" cellspacing="0" width="64%">
<tr>
<td width="28%"><font face="Verdana" size="2">Titolo commento:</font></td>
<td width="72%"><font face="Verdana" size"2"><%RS("titolo")%></font></td>
</tr>
<tr>
<td width="28%"><font face="Verdana" size="2">Commento:</font></td>
<td width="72%"><font face="Verdana" size="2"><%=RS("messaggio")%></font></td>
</tr>
<tr>
<td width="28%"><font face="Verdana" size="2">Autore:</font></td>
<td width="72%"><font face="Verdana" size="2">"><%=RS("autore")%></font></td>
</tr>
<tr>
<td width="28%"><font face="Verdana" size="2">Data inserimento:</font></td>
<td width="72%"><font face="Verdana" size="2"><%=RS("data")%></font></td>
</tr>
</table>
<hr>
<%
' COMPLETA LA VISUALIZZAZIONE DEI MESSAGGI E CHIUDE LA CONNESSIONE
' AL DATABASE
iRecordsShown = iRecordsShown + 1
RS.MoveNext
Loop
End If
RS.Close
Set RS = Nothing
Conn.Close
%><center>
<%
'MOSTRA IL NUMERO DELLE PAGINE,
'DATO CHE VERRANO MOSTRATI
'IN QUESTO ESEMPIO 5 MESSAGGI PER PAGINA
For x=1 to iPageCount
%>
<font face="Verdana" size="2">[ <%=x%> ]</font>
<%
next
%>
<p align="center"><font size="2" face="Verdana">Inserisci messaggio</font></p>
</body>
</html>

Rispondi quotando
