Buongiorno.

Ho questo script che mi estrapola i dati contenuti in un database:

codice:


<%
if request("dtype") = "" then dtype = dtype else dtype = request("dtype")
if catid = "" then catid = request("catid")
if recid = "" then recid = request("recid")
if weburl = "" then weburl = Request.ServerVariables("url") 
if dtype = "2" then
	if catid = "" then catid = 1
	Response.Write DisplayData(2, catid, "", weburl)
	nDisplayRecs = 2
end if

Function DisplayData(dtype, catid, recid, filename)

	tablestyle = """BORDER-RIGHT: #f2f0f4 0px solid; BORDER-TOP: #f2f0f4 0px solid; BORDER-LEFT: #f2f0f4 0px solid; BORDER-BOTTOM: #f2f0f4 0px solid"""
	headerfontsize = "2"
	headerfontcolor = "white"
	fontface = "Arial"
	fontcolor = "black"
	

	
	set dataconn =Server.CreateObject("ADODB.Connection")
	dataconn.ConnectionString = xDb_Conn_Str
	dataconn.open

		Select case dtype

		case 2
			
			query = "select catname from NMCattbl where catid = "& catid
			set rs = dataconn.Execute(query)
				if not rs.eof then
					Response.Write "
<TABLE WIDTH=100% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
					Response.Write "<tr><td colspan=2 width=100% valign=top></td></tr>"
					query1 = "select newsid,newsname,newsdateadded,newsdescription,newsdoc1name from NMNewstbl where catid = "& catid &" and activated = "& true & " and newsexpiry > #"& date() &"# order by newsdateadded desc"
					set rs1 = dataconn.Execute(query1)
						if rs1.eof then
							Response.Write "<tr><td colspan=2 width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">Currently there are no News Articles in this Section</font></td></tr>"
						else
							do until rs1.eof
								Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">"
								if rs1(4) <> "" then 
									Response.Write "<center>[img][/img]</center>"
								end if
								Response.Write ""&rs1(1)&" "&rs1(2)&"
"&rs1(3)&"
Leggi tutto</font></td></tr>"
							rs1.movenext
							loop
						end if
					rs1.close
					set rs1 = nothing
					Response.Write "</table>"
				else
					Response.Write "
<TABLE WIDTH=100% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
					Response.Write "<tr><td width=100% bgcolor="& headerbgcolor&" valign=top><FONT face="&fontface&" size="& headerfontsize&" color="& headerfontcolor&">No Category found with this Id.</font></td></tr>"
					Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">News Articles not found.</font></td></tr>"
					Response.Write "</table>"
				end if
			rs.close
			set rs = nothing

		case else
		End select

	dataconn.Close
	set dataconn = nothing

End Function%>
Lo script fa vedere tutte le news, mentre io vorrei farne visualizzare solo le prime 5.

Vorrei sapere cosa e dove devo modificare il codice.

Ciao e grazie.