There are no data to read

Delphi

14/09/2006

Senhores,

Estou fazendo uma consulta de uma determinada tabela de usuários da seguinte maneira:

Var
DrUsuario : FbDataReader;
Crypt : TCrypt;
begin
FbConexao.Open;
Try
Crypt:=TCrypt.Create;
CmdUser.Parameters[´pUSUARIO´].Value:=Usuario.ToUpper;
DrUsuario:=CmdUser.ExecuteReader;
if DrUsuario.HasRows then
Begin
DrUsuario.Read;
If (DrUsuario[´USUARIO´].ToString.Trim<>Usuario) Then
Begin
if (Crypt.Descriptografa(DrUsuario[´SENHA´].ToString)<>Senha) then
Result:=2
Else
Result:=0
End
end
Else
Result:=1;
finally
FbConexao.Close;
end;

Quando a consulta retorna algum registro, a rotina funciona normalmente, agora quando não retorna nenhum registro dá o seguinte erro: ´There are no data to read. Information regarding the origin and location of the exception can be identified using the exception stack trace below´. O erro acontece na linha em que faço a comparação [b:f208330659]If (DrUsuario[´USUARIO´].ToString.Trim<>Usuario) Then[/b:f208330659]

Estou usando DELPHI 2006 FOR NET e banco de dados FIREBIRD 1.5.

Agradeço que puder me dá uma ajuda,


Chmeireles

Chmeireles

Curtidas 0
POSTAR