Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Conexión con bases de datos (https://www.clubdelphi.com/foros/forumdisplay.php?f=2)
-   -   sybase + storeprocedure y RollBack (https://www.clubdelphi.com/foros/showthread.php?t=32554)

Enan0 09-06-2006 03:24:11

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;


La franja horaria es GMT +2. Ahora son las 11:06:36.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi