Tengo varios fomrs creados con sus controles
tengo un datamodulo con sus tablas....
y en la unidad pricipal este es el codigo ....
Código Delphi
[-]Application.Initialize;
Application.Title:='Mi proyecto';
Application.CreateForm(TDataSir, DataSir);
frmClave:=TFrmClave.Create(Nil);
if FrmClave.ShowModal=1 then
begin
Application.CreateForm(TFrmPrincipal, FrmPrincipal);
Application.CreateForm(TFrmprimero, Frmprimero);
Application.CreateForm(TFrsegundo, FrmSegundo);
.
Application.Run;
end
else Application.Terminate;
end.
como se ve esta rutina llama a un form modal en el que ingreso la clave y el usuario.....
el formClave que llamo de forma modal tiene dos tedit con las que coloco el usuario y la clave
para luego ejecutar la consulta.....
Código Delphi
[-]procedure TFrmClave.BtnIngresarClick(Sender: TObject);
begin
c_usuario.Close;
C_usuario.Params.ParamValues['ValUsuario']:=TxtUsuario.Text;
C_usuario.Params.ParamValues['Valclave']:=Txtclave.Text;
C_usuario.Open;
if not C_usuario.Eof then modalresult:=mrok
else modalresult:=mrCancel;
end;
como se ve lo que hago es lanzar una consulta con dos parametros y si devuelve al menos un resultado (no eof) entonces entro si no se lanza el application.terminate
en caso de que el usuario cierre la ventana
Código Delphi
[-]procedure TFrmClave.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
modalresult:=mrCancel;
end;
ASI PUES ME SALE EL SIGUIENTE ERROR(EN UNA VENTANITA)
Proyect Miproyecto raised exception class
EAccessViolation with message 'Access Violation
ata address 00672377 in module 'Miproyecto' read
of address 00EF1908'. Proyect stopped
Y ME COLOCA EN LA SIGUIENTE RUTINA OLEDBACcess(EL DEPURADOR)
Código Delphi
[-]procedure TOLEDBConnection.Disconnect;
begin
if FConnected then begin
if FIDBInitialize <> nil then
FIDBInitialize.Uninitialize;
ReleaseInterfaces;
FConnected := False;
FreeAndNil(FColumnsMetaInfo);
FreeAndNil(FColumnsRowsetFieldDescs);
end;
end;
LA VERDAD NO SE QUE ES LO QUE HAGO MAL ACA ....
AGRADEZCO SU AYUDA O ALGUN METODO ALTERNATIVO DE HACER UN FORM PARA CLAVE QUE ENTRE O NO A LA APLICACION SEGUN LOS DATOS SUMINISTRADOS....