Nella seguente sub mi restituisce errore se un utente immette uno username che non esiste. Come faccio a controllare che il risultato della mia query abbia restituito realmente (almeno) una riga dal db?

Grazie 1000



sub validazione(obj as Object, args as ServerValidateEventArgs)
dim myConnection as new OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\g.ferri\Documenti\Web\Nuovo\mdb-database\dbFotografie.mdb")

'open connection
dim myCommand as new OleDbDataAdapter("select * from tblFotografie where username='"+tbUserName.text+"'", myConnection)

'fill dataset
dim ds as DataSet = new DataSet()
myCommand.Fill(ds, "tblFotografie")

dim dTable as DataTable = ds.Tables("tblFotografie")
if args.Value = dTable.Rows(0)("pwd") then
args.IsValid = true
else
args.IsValid = false
end if
end sub