...
function TForm1.UsuarioValido(const aName, aPassword: string): Boolean;
begin
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('SELECT USR_NAME, USR_PWD FROM USUARIOS');
SQL.Add('WHERE USR_NAME =:PUSRNAME AND USR_PWD =:PUSERPWD');
Parameters.ParamByName('PUSRNAME').Value := aName;
Parameters.ParamByName('PUSERPWD').Value := aPassword;
Open;
Result:= not IsEmpty;
Close;
end;
end;
...
procedure TForm1.btnIngresarClick(Sender: TObject);
begin
if not UsuarioValido(ComboBox1.Text,Edit2.Text) then
begin
MessageBox(Handle, 'Los datos ingresados son incorrectos',
'ERROR', MB_ICONERROR + MB_OK);
Close
end;
end;