Ver Mensaje Individual
  #1  
Antiguo 09-06-2006
Avatar de Enan0
Enan0 Enan0 is offline
Miembro
 
Registrado: may 2004
Ubicación: Argentina
Posts: 565
Reputación: 20
Enan0 Va por buen camino
sybase + storeprocedure y RollBack

Hola Amigos. tengo un pequeñito inconveniente.
Estoy trabajando con una aplicacion ya desarrollada la cual debo verificar como funciona.
la misma esta hecha con los componentes DBE. anda todo perfecto. se utiliza para eliminar unas datos de unas tablas, por medio de storeprocedures.. es problema es que no me funciona el RollBACK

aca dejo un poco del codigo, talvez el problema ande por ahi.. yo no he podido encontrarlo.. saludos.


Código Delphi [-]

(*tpDelBy..=TstoredProc
   TT4db = Tdatabase*)

        if not tt4db.InTransaction then
          tt4db.StartTransaction;

        if chkTasks.Checked then
        begin
          if stpDelByDate.Active then  stpDelByDate.Active:=false;
          stpDelByDate.ParamByName('@ATYPE').Value:=0;
          stpDelByDate.ParamByName('@ADATE').Value:=SelectedDate;
          stpDelByDate.ParamByName('@TOTALROWS').Value:=0;
          stpDelByDate.ExecProc;
          Totalrecs:=Totalrecs+stpDelByDate.ParamByName('@TOTALROWS').Value;
        end;

        if chkAppts.Checked then
        begin
          if stpDelByDate.Active then  stpDelByDate.Active:=false;
          stpDelByDate.ParamByName('@ATYPE').Value:=4;
          stpDelByDate.ParamByName('@ADATE').Value:=SelectedDate;
          stpDelByDate.ParamByName('@TOTALROWS').Value:=0;
          stpDelByDate.ExecProc;
          Totalrecs:=Totalrecs+stpDelByDate.ParamByName('@TOTALROWS').Value;
        end;

        if chkContacts.Checked then
        begin
          if stpDelByDate.Active then  stpDelByDate.Active:=false;
          stpDelByDate.ParamByName('@ATYPE').Value:=1;
          stpDelByDate.ParamByName('@ADATE').Value:=SelectedDate;
          stpDelByDate.ParamByName('@TOTALROWS').Value:=0;
          stpDelByDate.ExecProc;
          Totalrecs:=Totalrecs+stpDelByDate.ParamByName('@TOTALROWS').Value;
        end;

        if chkAllOthers.Checked then
        begin
          if stpDelOthers.Active then  stpDelOthers.Active:=false;
          stpDelOthers.ParamByName('@ADATE').Value:=SelectedDate;
          stpDelOthers.ParamByName('@TOTALROWS').Value:=0;
          stpDelOthers.ExecProc;
          Totalrecs:=Totalrecs+stpDelOthers.ParamByName('@TOTALROWS').Value;
        end;

        if chkNotes.Checked then
        begin
          if stpDelAttached.Active then  stpDelAttached.Active:=false;
          stpDelAttached.ParamByName('@ADATE').Value:=SelectedDate;
          stpDelAttached.ParamByName('@TOTALROWS').Value:=0;
          stpDelAttached.ExecProc;
          Totalrecs:=Totalrecs+stpDelAttached.ParamByName('@TOTALROWS').Value;
        end;

        if totalrecs>0 then
        begin
          delMsg:=IntToStr(Totalrecs)+
                  ' selected records for all users, older than and equal to '+
                  msgDate + ' will be deleted, are you sure?';
          if MessageDlg(delMsg,mtWarning,[mbYes,mbNo],0)=mrYes then
          begin
            if tt4db.InTransaction then
            begin
              tt4db.commit;
              stbMsg.Panels[0].Text:=IntToStr(Totalrecs)+
                                     ' selected record(s) were deleted';
            end;
          end
          else
          begin
            if tt4db.InTransaction then  tt4db.Rollback;
            stbMsg.Panels[0].Text:='All affected record(s) were rollbacked';
          end;
Responder Con Cita