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)
-   -   Error al postear un registro eliminado (https://www.clubdelphi.com/foros/showthread.php?t=88229)

alexglez1255 04-05-2015 06:27:04

Error al postear un registro eliminado
 
Hola amigos del club delphi
A ver si alguno de ustedes tiene alguna idea por que me da error en la linea CDSCONTRAUNCLIENTE.POST.manejo campos anidados
donde la primera tabla CLIENTES TIENE UN CAMPO

object cdsUnClienteqryuncontra: TDataSetField
FieldName = 'qryuncontra'
end

EL CUAL USO PARA LOS CONTRATOS...LO DOY DE ALTA BIEN Y LO GRABO PARA OBTENER EL CODIGO AUTOMATICO POR MEDIO DE UN TRIGGER EN EL INTERBASE..

EL PROBLEMA ES QUE TENGO UN BOTON PARA QUITAR EL CONTRATO UNA VES DOY EL POST ME MANDA EL SIGUIENTE MENSAJE

'cdsContratuncliente: Cliendataset not in edit or insert mode' pero si notan en el codigo si la pongo en edit mode, y para asegurarme pongo un case el cual me confirma que efectivamente esta en edit mode.. me explico..? tengo ya como 4 dias y no logro saber cual es el error...muchas gracias por su gran ayuda
Código Delphi [-]
procedure Taltadecontratos.BtquitarcontratoClick(Sender: TObject);
 var
   estadotabla:string;
 begin
  If Application.messagebox('Seguro que desea cancelar contrato ?','ATENCION !!',mb_iconquestion or mb_yesno)=id_yes
   then  with LogicaNegocio do
     begin
       If Contratoguardado=True then
        begin
           cdsUnCliente.Open;
           cdsUnCliente.Edit;
           cdsContratUnCliente.Open;
           cdsContratUnCliente.Edit;
            case cdsContratUnCliente.State  of
             dsInactive:estadotabla:='inactiva';
             dsBrowse    :estadotabla:='en estado browse';
             dsEdit      :estadotabla:='en edit';
             dsInsert    :estadotabla:='en insert mode';
             dsSetKey    :estadotabla:='solo busqueda';
             dsCalcFields:estadotabla:='dscalcfields';
             dsFilter   :estadotabla:='dsfilter';
             dsNewValue   :estadotabla:='dsnewvalue';
             dsOldValue   :estadotabla:='Dsoldvalue';
             dsCurValue   :estadotabla:='dsCurValue';
             dsBlockRead :estadotabla:='dsBlockRead';
             dsInternalCalc:estadotabla:='dsInternalCalc';
             dsOpening  :estadotabla:='dsOpening';
            Else
              estadotabla:='ninguna de las opciones';
            End;
            ShowMessage('El estado de la tabla es :'+estadotabla);
           If cdsContratUnCliente.Locate('Cod_contrato',IntToStr(CodContratoNuevo),[loCaseInsensitive]) then
             begin
               cdsContratUnCliente.delete;
               cdsContratUnCliente.Post;
               cdsContratUnCliente.ApplyUpdates(0);
               modulodatos.IBTransaction1.Commit;
               btnBuscarCte.Enabled:=True;
               BtDardealtaacliente.Enabled:=True;
               insertarcontrato:=False; // desactivamos bandera de contrato insertado
               Btinsertcontrato.Enabled:=True;
   //Contratoguardado:=False;
               Btquitarcontrato.Enabled:=False;
               logicanegocio.cdsArticContUnCliente.close;
               Btguardarcontrato.Enabled:=False;
             end
           Else  cdsContratUnCliente.delete;
        end;
     end;
  end;

alexglez1255 04-05-2015 07:16:30

gracias ya supe cual es el problema con el delete no se usa el post .....jajajajajajaja perdon....


La franja horaria es GMT +2. Ahora son las 04:40:53.

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