ecfisa gracias por responder a mi pregunta, cuando ingreso el código (function LoginAccepted(qy: TIBQuery; const nam, pwd: string): Boolean; ) se pinta de color rojo y me bota error nose si lo este haciendo bien pero yo lo puse aquí(este es todo el código del form con el nombre
(AccesoalSistema)):
Código Delphi
[-]
unit AccesoalSistema;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, DBCtrls, ExtCtrls, Mask;
type
TLogin = class(TForm)
Panel: TPanel;
Text1: TLabel;
Text2: TLabel;
Empresa: TLabel;
Agencia: TLabel;
Usuario: TLabel;
Password: TLabel;
edtEmpresa: TDBLookupComboBox;
edtAgencia: TDBLookupComboBox;
edtUsuario: TDBLookupComboBox;
Aceptar: TBitBtn;
Cancelar: TBitBtn;
edtPassword: TEdit;
procedure CancelarClick(Sender: TObject);
procedure AceptarClick(Sender: TObject);
private
public
end;
var
Login: TLogin;
implementation
uses DataModule01, SistemaPrincipal01;
function LoginAccepted(qy: TIBQuery; const nam, pwd: string): Boolean;
begin
qy.Close;
qy.SQL.Clear;
qy.SQL.Add('SELECT DES_USUARIO, PWD_USUARIO');
qy.SQL.Add('FROM SIS_USUARIOS WHERE DES_USUARIO = :NOMBRE');
qy.ParamByName('NOMBRE').AsString := nam;
qy.Open;
Result := not qy.IsEmpty and (qy.FieldByName('PWD_USUARIO').AsString = pwd);
qy.Close;
end;
{$R *.dfm}
procedure TLogin.CancelarClick(Sender: TObject);
begin
close;
end;
procedure TLogin.AceptarClick(Sender: TObject);
begin
end;
procedure TForm1.btnAceptarClick(Sender: TObject);
begin
if not LoginAccepted(Datamodule1.IBQPassword1, EditUsuario.Text, EditPassword.Text) then
raise Exception.Create('El usuario o la contraseña son inválidos.');
end.