...per chi conosce ASP dovrebbe essere una cosa d anulla...
Come posso creare una select che mi estrae (per poi stamapre a video) l'ultimo record inserito nel campo ID (contatore) che ovviamente è anche il più alto....
GRAZIE!
...per chi conosce ASP dovrebbe essere una cosa d anulla...
Come posso creare una select che mi estrae (per poi stamapre a video) l'ultimo record inserito nel campo ID (contatore) che ovviamente è anche il più alto....
GRAZIE!
http://www.adottauntetto.com
dipende un po' dal database...
su access:
codice:SELECT top 1 * FROM tabella ORDER BY id DESC
Purtroppo bisogna imparare che il computer non sbaglia...fa solo quello che gli dici di fare
www.netpolaris.it
sto usando questo codice:
<%
Set rsorder = Server.CreateObject("ADODB.RecordSet")
' Open the table
rsorder.Open "orders", strConn, adOpenKeySet, adLockPessimistic, adCmdTable
' Add a new record
rsorder.AddNew
rsorder("dfname") = "ma222tta"
rsorder("dlname") = "linoq"
rsorder("daddress1") = "sddr"
rsorder("daddress2") = "sdr"
rsorder("dcity") = "sity"
rsorder("dstate") = "ta"
rsorder("dzip") = "zip"
rsorder("dcountry") = "country"
rsorder("date")=date() & " " & time()
rsorder("custid")= "22"
rsorder.update
rsorder.Close
Set rsorder = Nothing
'---------------------
Set apri2 = Server.CreateObject("ADODB.RecordSet")
' Open the table
apri2.Open "orders", strConn, adOpenKeySet, adLockPessimistic, adCmdTable
'set rsid=db.execute("select top 1 orderidcont from orders")
set rsid=db.execute("SELECT top 1 * FROM orders ORDER BY orderidcont DESC")
idconto = rsid("orderidcont")
response.write "L'id conto è: "
response.write idconto
apri2.Close
Set apri2 = Nothing
'-----------------
db.close
set db=nothing
%>
....IL PROBLEMA E' CHE MI PRENDE IL tOP 1 ID PRIMA DELL'UPDATE ANCHE SE CHIUDO UNA CONNESSIONE E NE RIAPRO UN'ALTRA...
COME POSSO FARE?
(GRAZIE COMUNQUE)
http://www.adottauntetto.com