Ciao a tutti; ho questo codice che randomicamente estrae dei records casuali da un db access:
codice:
<%
ID = Request.QueryString("id")
IF ID = "" THEN
ID = 0
END IF
SELECT CASE ID
CASE 0 ' Quando è il primo accesso
open_recordset rs_getQuote,"select * from quote"
open_recordset rs,"select * from idate"
if month(now()) < 10 then
imonth = "0"& month(now())
else
imonth = month(now())
end if
idate1 = day(now()) & "/" & imonth & "/" & year(now())
idate2 = formatdatetime(rs("iday"),2)
rs.close
Randomize Timer
intRnd = (Int(RND * rs_getQuote.RecordCount))
if iquote_of_the_day = "1" then
if idate1 <> idate2 then
sql_update = "update config set config_value="&intRnd&" where config_variable = 'number_quote_of_the_day' "
conn.Execute(sql_update)
sql_update = "update idate set iday='"&now()&"'"
conn.Execute(sql_update)
rs_getQuote.Move intRnd
else
rs_getQuote.Move inumber_quote_of_the_day
end if
else
if session("id") = intRnd then
do while session("id") = intRnd
intRnd = (Int(RND * rs_getQuote.RecordCount))
loop
end if
rs_getQuote.Move intRnd
session("id") = intRnd
end if
campoMemo=replace(rs_getQuote("quote"),chr(13),"
")
strCitazione = Mid(campoMemo,1,1000)
strAutore = rs_getQuote("author")
ID = rs_getQuote("id")
strLink = "<span class='testo'>"& strCitazione & "</span><a href='index.asp?id="& ID &"' target='_self'>
Continua</a>"
CASE ELSE ' Quando si è cliccato su continua per visualizzare il resto della frase
open_recordset rs_getQuote,"select * from quote where ID = " & ID
campoMemo=replace(rs_getQuote("quote"),chr(13),"
")
strCitazione = campoMemo
strAutore = rs_getQuote("author")
strLink = "<span class='testo'>"& strCitazione & "</span>"
strLink = strLink & "
<a href='index.asp' target='_self'>
Altre citazioni</a>"
END SELECT
%>
Se richiamo la pagina con questo codice, tutto funziona bene, ma se voglio raggiungere questa pagina da un'altra pagina con un link del tipo:
la condizione
codice:
strCitazione = Mid(campoMemo,1,1000)
non viene più rispettata ma si visulizza l'intero testo contenuto nel recordset... :master: Qual'è l'errore????