<%

SQL = "select Max(id) as maxid, Min(id) as Minid from tabella where val >= 1000"

rs.open SQL, cn, 3,3

maxID = rs("MaxID")
minID = rs("MinID")

randomize()
dim valorernd

valorernd = Int((maxID - minID + 1) * Rnd + minID)

rs.close
cn.close


sql2 = "select val2 from tabella where id =" &valorernd
rs.open SQL2, cn, 3,3
val2 = rs("val2")
response.write val2
rs.close
cn.close

%>


mi da questo errore:

ADODB.Recordset error '800a0e7d'

The connection cannot be used to perform this operation. It is either closed or invalid in this context.

alla linea 22