Ver Mensaje Individual
  #6  
Antiguo 14-03-2007
Avatar de pnsd_89
pnsd_89 pnsd_89 is offline
Miembro
 
Registrado: mar 2007
Posts: 112
Reputación: 18
pnsd_89 Va por buen camino
Arrow Ok...

Código Delphi [-]
procedure TFSucursal.BitBtn3Click(Sender: TObject);
var
   sSQL, sFROM, sWHERE, sORDER, sEsquema,sent: string;
begin
     sSQL   := EmptyStr;
     sFROM  := EmptyStr;
     sWHERE := EmptyStr;
     sORDER := EmptyStr;

     sEsquema := 'dba.';


     sSQL  := 'select * ';
     sFROM := 'from '+sEsquema+'sucursal_mh ';
     sWHERE:= 'where 0 = 0 ';

     if not ( Trim( DBLFiltra_sucursal.Text ) = EmptyStr ) then
        sWHERE := sWHERE + 'and cod_sucursal_mh = '+ (DBLFiltra_sucursal.KeyValue);
     sORDER := ' order by des_sucursal_mh';
     DMSucursales.QrySucursal_MH.SQL.Clear;
     DMSucursales.QrySucursal_MH.SQL.Add ( sSQL + sFROM + sWHERE + sORDER );
     DMSucursales.CDSsucursal_mh.Close;
      sent:=(sSQL+sFROM+sWHERE+sORDER);
      ShowMessage(sent);
     UCerrarAbrirPG(DMSucursales.CDSsucursal_mh, Self); {aqui salta a la funcion (en realidad no se si es una funcion o petodo. y salta a este codigo siguiente En un na UNIDAD01}

{...}

Código Delphi [-]
procedure UCerrarAbrirPG(DataSet: TDataSet; Sender : TForm);
var
   nombre, ErrorM : string;
begin
     ErrorM := '';
     nombre := DataSet.Name;
     if BaseDatosPG.InTransaction then {EN este lugar no entra y salta el error }
        begin
             try
                DataSet.Close;
             except
                on E: Exception do
                   UAbrirMensaje('Error al cerrar el componente '+nombre+'.'+#13+#10+'Mensaje : '+E.Message,ierror,sender);
             end; {try}
             try
                DataSet.Open;
             except
                on E: Exception do
                   UAbrirMensaje('Error al abrir el componente '+nombre+'.'+#13+#10+'Mensaje : '+E.Message,ierror,sender);
             end; {try}
        end {if}
     else
        begin
             try
               DataSet.Close;
             except
               on E: Exception do
                  UAbrirMensaje('Error al cerrar el componente '+nombre+'.'+#13+#10+'Mensaje : '+E.Message,ierror,sender);
             end; {try}
             IniciarTransaccionPG;
             try
                BaseDatosPG.StartTransaction(TDPG);
                DataSet.Open;
                BaseDatosPG.Commit(TDPG);
             except
                on E: Exception do
                   begin
                       BaseDatosPG.Rollback(TDPG);
                       UAbrirMensaje('Error al abrir el componente '+nombre+'.'+#13+#10+'Mensaje : '+E.Message,ierror,sender);
                   end; {on}
             end; {try}
        end; {else}
end;

Edito este mensaje para añadir las etiquetas [ delphi ].

Última edición por dec fecha: 14-03-2007 a las 22:19:54.
Responder Con Cita