ciao grazie del consiglio, ho provato cosi ma da errore
ADODB.Field error '80020009'
Il record corrente corrisponde all'inizio o alla fine del file oppure è stato eliminato. Per eseguire l'operazione richiesta è necessario disporre di un record corrente.
/leggi_news.asp riga 0
metto il codice che uso
pagina news.asp che stampa tutte le categorie inserite nella tabella categorie
codice:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>News</title>
<link href="css_news/news.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div id="header">
<h1>Intestazione</h1>
</div>
<div id="sidebar_left">
<h3>Contenuto sidebar1</h3>
<ul>
[*]Home
[*]Arichivio News[/list]
</div>
<div id="mainContent">
<h1> Contenuto principale</h1>
<%
' PERCORSO DEL DATABASE'
url_DB = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("/news/mdb-database/db.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
conn.Open url_DB
Set RecSet = Server.CreateObject("ADODB.Recordset")
' PRELEVA LE ULTIME 10 CATEGORIE DAL DATABASE (SE SONO PRESENTI)'
SQL = "SELECT TOP 10 * FROM categorie ORDER BY ID DESC"
RecSet.Open SQL, Conn, adOpenStatic, adLockOptimistic
' CONTROLLA SE SONO PRESENTI CATEGORIE NEL DB'
If RecSet.Eof = False Then
%>
<table border="0" cellpadding="0" cellspacing="0" width="34%">
<%
' VISUALIZZA LE PRIME 10 CATEGORIE
Do until RecSet.Eof
%>
<tr>
<td width="6%"><font face="Verdana" size="2">></font></td>
<td width="94%"><font face="Verdana" size="2">"><%=RecSet("categorias")%></font></td>
</tr>
<%
RecSet.Movenext
Loop
%>
</table>
<%
End IF
RecSet.Close
Conn.Close
Set Conn = Nothing
Set RecSet = Nothing
%>
</div>
<br class="clearfloat" />
</div>
</body>
</html>
codice pagina leggi_news.asp
codice:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Leggi News</title>
<link href="css_news/news.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
<![endif]-->
</head>
<body>
<%
' RICHIEDE L'ID
ID = Request("ID")
' SE NON E' STATO PASSATO UN VALORE VALIDO
' COME ID, IMPOSTA QUESTO AD UNO
If not ISNumeric(ID) or Len(ID) = 0 Then
ID = 1
End IF
' SE L'ID E' UGUALE A ZERO
' LO IMPOSTA UGUALE A UNO
IF ID = 0 Then
ID = 1
End IF
' PERCORSO DEL DATABASE
url_DB = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("/news/mdb-database/db.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
conn.Open url_DB
Set RecSet = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM NEWS WHERE ID = " & Request.Querystring(id) &""
RecSet.Open SQL, Conn, adOpenStatic, adLockOptimistic
If RecSet.Eof = False Then
End IF
%>
<h2 class="error">Errore: Nessuna news presente!</h2>
<div id="container">
<div id="header">
<h1>Intestazione</h1>
</div>
<div id="sidebar_left">
<h3>Contenuto sidebar1</h3>
<ul>
[*]Home
[*]Arichivio News[/list]
</div>
<div id="mainContent">
<h1> Contenuto principale</h1>
<font face="Verdana" size="4">> <%=RecSet("titolo")%>
</font>
<font face="Verdana" size="4">Categoria: <%=RecSet("categoria")%>
</font><font face="Verdana" size="2">di
<%=RecSet("autore")%> - <%=RecSet("data")%></font></p>
<font face="Verdana" size="2"><%=RecSet("contenuto")%></font></p>
</p>
<%
Conn.Close
Set Conn = Nothing
Set RecSet = Nothing
%>
</div>
<br class="clearfloat" />
<div id="footer">
Piè di pagina
</p>
</div>
</div>
</body>
</html>
mi potete aiutare? prefavore
grazie