with recordset //cosa vuol dire questo?
Do While .EOF and Trovato=False //loop finchè trovato = falso e .eof cosa è?
if !USER=id.password and !PASSWORD =password.text then //' se user = forse volevi scrivere user.text? e password = text.text allora metti quello true
Trovato=True
end if
.movenext //' movenext cosa significa?
Loop
if Trovato=True then
'fai quello che vuoi....
else
'login errato..
end if
end with //' si chiude il with recordset?
In VB 6.0
With/End With è un costrutto per specificare un ambito. In parole
povere vuol dire che tutto quello che scrivi tra With ed End With
è riferito all'oggetto specifico.
With recordset, quindi, vuol dire che in questo ambito fai
all'oggetto recodset. Per cui le proprietà ed i metodi di questo
oggetto non devono necessariamente essere preceduti dal nome dello
stesso.
Con il costrutto With/End With si compatta il codice. Senza
With/End With avresti dovuto scrivere :
codice:
Do While recordset.EOF and Trovato=False
if recordset!USER=user.Text and recordset!PASSWORD =password.text then
' if recordset!USER=id.password and recordset!PASSWORD =password.text then
Trovato=True
end if
recordset.movenext
Loop
invece di :
codice:
with recordset
Do While .EOF and Trovato=False
if recordset!USER=user.Text and recordset!PASSWORD =password.text then
'if !USER=id.password and !PASSWORD =password.text then
Trovato=True
end if
.movenext
Loop
EOF è una proprietà dei RecordSet ed indica, se True, che non ci sono
più records. Per cui il ciclo Do While si interrompe dopo l'ultimo
record, oppure non è iniziato se il recordset è vuoto.
La If è effettivamente errata, se le textbox si chiamano user e
password la if è quella che ho già inserito nel codice.
MoveNext è il metodo del RecordSet che ti posiziona al prossimo
record.
Ciao,