<%Response.Expires = 0
Dim rs, cn, sql
Set rs = Server.CreateObject("ADODB.Recordset")
Set cn = Server.CreateObject("ADODB.Connection")

sql = "SELECT News.Data, News.Descrizione, News.Testo, News.Immagine FROM News ORDER BY News.Data DESC, News.ID DESC"

cn.Open "Driver=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("Db/Notizie.mdb")
Set rs.ActiveConnection = cn

function fecomm(stringa)
IF TRIM(stringa & "[]")="[]" THEN EXIT FUNCTION

if StrComp(stringa,"") <> 0 then
fecomm = replace(stringa, "&", "%26")
end if
end function


rs.CursorType = adOpenStatic
'rs.LockType = adLockOptimistic
rs.Source = "News"
rs.Open sql, cn

x = 0
Do until(x=4)
x = x + 1
Response.Write("date"&x&"="&rs("Data")&"&descrizio ne"&x&"="&fecomm(rs("Descrizione"))&"&testo"&x&"=" &fecomm((rs("Testo")&""))&"&immagine"&x&"="&fecomm (rs("Immagine")))
rs.MoveNext
If x<5 then Response.Write("&")
Loop

rs.Close
Set rs=Nothing
%>