ascò, io avevo il seguente codice:
Dim oCn, oRs, rSQL, idMIN, idMAX, idSELECT, iPath
on error resume next
Set oCn = DBConnexion(DB_MAIN)
rSQL = "SELECT min(iID) as MIN, max(iID) as MAX FROM images where iValid = 1"
Set oRs = DBRecordSet(oCn, rSQL)
idMIN = Server.URLEncode(oRs("MIN"))
idMAX = Server.URLEncode(oRs("MAX"))
oRs.Close
set oRs = Nothing
Randomize
idSELECT = Int((idMAX-idMIN) * Rnd) + idMIN
rSQL = "SELECT * FROM images where iValid = 1 and iID >= " & idSELECT
Set oRs = DBRecordSet(oCn, rSQL)
iPath = oRs("iSourceSmall")
Response.Write ("<table class=""immagini"" align=""center"" border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"">") & vbCRLF
Response.Write("<tr border=""0"">") & vbCRLF
Response.Write " <td align=""center"" valign=""middle"" >" & vbCRLF
if iPath <> "" then
Response.Write "[img][/img]"
Response.Write "<div class=""imgtitle"">" & oRs("iTitle") & "(" & oRs("iHits") & ")"& "</div>"
End if
Response.Write " </tr></td>" & vbCRLF
Response.Write " </table>" & vbCRLF
oRs.Close
set oRs = Nothing
oCn.Close
set oCn = Nothing
CreateBottomTable ""
End Sub
%>
e funzionava benissimo... ora ho il seguente, che sto cercando di adattare ad un altro database:
<%
Sub DisplayPhoto()
CreateTopTable "Immagini", GetTranslation("LANG_LISTEN_TO_PHOTO")
Dim oCn, oRs, rSQL, idMIN, idMAX, idSELECT, iPath
on error resume next
Set oCn = DBConnexion(DB_absoluteig.mdb)
rSQL = "SELECT min(imageid) as MIN, max(imageid) as MAX FROM xlaAIGimages where status = 1"
Set oRs = DBRecordSet(oCn, rSQL)
idMIN = Server.URLEncode(oRs("MIN"))
idMAX = Server.URLEncode(oRs("MAX"))
oRs.Close
set oRs = Nothing
Randomize
idSELECT = Int((idMAX-idMIN) * Rnd) + idMIN
rSQL = "SELECT * FROM xlaAIGimages where status = 1 and imageid >= " & idSELECT
Set oRs = DBRecordSet(oCn, rSQL)
iPath = oRs("iSourceSmall")
Response.Write ("<table class=""immagini"" align=""center"" border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"">") & vbCRLF
Response.Write("<tr border=""0"">") & vbCRLF
Response.Write " <td align=""center"" valign=""middle"" >" & vbCRLF
if iPath <> "" then
Response.Write "[img][/img]"
Response.Write "<div class=""imgtitle"">" & oRs("imagename") & "(" & oRs("hits") & ")"& "</div>"
End if
Response.Write " </tr></td>" & vbCRLF
Response.Write " </table>" & vbCRLF
oRs.Close
set oRs = Nothing
oCn.Close
set oCn = Nothing
CreateBottomTable ""
End Sub
%>
e mi restituisce appunto come errore
ErroreSQL 424: Necessario oggetto
SQL : SELECT min(imageid) as MIN, max(imageid) as MAX FROM xlaAIGimages where status = 1
ErroreSQL 424: Necessario oggetto
SQL : SELECT * FROM xlaAIGimages where status = 1 and imageid >= 0
se fosse come dici tu, non avrebbe funzionato nemmeno prima![]()

Rispondi quotando