salve a tutti,
capisco che il caldo mi stia giocando brutti scherzi, ma sono convinto che sto facendo il giro del mondo in 80 giorni per una cosa che probabilmente sarebbe fattibile in un nulla...
qualcuno potrebbe controllarmi questo codice e dirmi come renderlo più fattibile?
il mio obiettivo è di aggiornare un valore in una tabella di un db in cui esiste un solo record avente due campi id=1 e presenze che è appunto il campo dove immetto il valore.
io lo vedo come un codice troppo lungo se poi si considera che manca ancora la fase di update del db qualcuno mi potrebbe dire come rendere tutto questo più performante per favore?codice:<% Session("Contatore")="" Valore="" 'Apro il db e recupero l'ultimo valore set myConn = server.CreateObject("ADODB.Connection") dim strConnDb strConnDb = "" strConnDb = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & server.mappath("/mdb-database/Clienti.mdb") myConn.Open(strConnDb) mySqlSelect = "select Presenze from Contatore" set myRSComS = server.CreateObject("ADODB.Recordset") myRSComS.Open mySqlSelect, myConn if not(myRSComS.EOF) and not(myRSComS.BOF) then do while not(myRSComS.EOF) Valore = myRSComS(Presenze) myRSComS.MoveNext loop else myRSComS.Close set myRSComS=nothing myConn.Close set myConn=nothing response.write(Valore) response.end() NuovoValore = cint(Valore) If (NuovoValore<999999) Then Valorefinale = NuovoValore+1 else Valorefinale = 0 end if StringaValore = cstr(Valorefinale) LunghezzaValore= len(StringaValore) If (LunghezzaValore=1) Then NumContatore= "00000" & StringaValore end if If (LunghezzaValore=2) Then NumContatore= "0000" & StringaValore end if If (LunghezzaValore=3) Then NumContatore= "000" & StringaValore end if If (LunghezzaValore=4) Then NumContatore= "00" & StringaValore end if If (LunghezzaValore=5) Then NumContatore= "0" & StringaValore end if If (LunghezzaValore=6) Then NumContatore= StringaValore end if Session("Contatore") = NumContatore %>
Grazie mille!![]()

Rispondi quotando