Ver Mensaje Individual
  #1  
Antiguo 18-09-2015
kcaARLOosz kcaARLOosz is offline
Registrado
NULL
 
Registrado: ago 2015
Posts: 9
Reputación: 0
kcaARLOosz Va por buen camino
Tabla paradox no me valida registro duplicado

Utilizo una tabla paradox que creo en tiempo de ejecución...

Código:
TT_Temp.Close;
    tmp := c:\directorio\tabla\
    if not directoryexists(tmp) then
      mkdir(tmp);
    TT_Temp.DatabaseName := tmp;
    TT_Temp.TableName := 'NombreTablaTemp.DB';
    TT_Temp.TableType := ttParadox;
    with TT_Temp.FieldDefs do begin
      Clear;
      Add('NOPROV', ftInteger, 0, True);
      Add('TIPOMOV', ftString, 2, True);
      Add('FOLIO', ftInteger, 0, True);
    end;
    with TT_Temp.IndexDefs do begin
      Clear;
      Add('', 'NOPROV;TIPOMOV;FOLIO', [ixPrimary, ixUnique]);
    end;
    TT_Temp.CreateTable;
    TT_Temp.Open;
Mi problema es el siguiente:

Código:
if TT_Temp.State in [dsInsert,dsEdit]then begin
              TT_TempNOPROV.AsInteger:= 1;
              TT_TempTIPOMOV.AsString:='AC';
              TT_TempFOLIO.AsInteger:=1;
              TT_Temp.Post;
            end;
Supongamos que guardo el primer registro con los valores (1,'AC',1) y el segundo con (1,'AC',2), bien funciona. Pero si estoy editando el primer registro y le doy post sin modificar ningún valor, aunque la tabla esté en edición, me marca Key Violation, cosa que no me pasa cuando edito el segundo registro y le doy post sin modificar nada.
Responder Con Cita