delphi
procedure TDMVarios.CiudadesAfterUpdateRecord(Sender: TObject; SourceDS: TDataSet; DeltaDS: TCustomClientDataSet; UpdateKind: TUpdateKind); begin Controlar('CIUDADES', 'CIUDADES', 'ID_CIUDAD', DeltaDS, UpdateKind); if (UpdateKind <> ukDelete) then if Modificado(DeltaDS, 'CIUDAD;DEPTO') then AsociarNombres(DeltaDS.FieldByName('ID_CIUDAD').OldValue, 'ASONOM_CIUDADES', 'ID_CIUDAD'); end; procedure TDMVarios.CiudadesBeforeUpdateRecord(Sender: TObject; SourceDS: TDataSet; DeltaDS: TCustomClientDataSet; UpdateKind: TUpdateKind; var Applied: Boolean); begin if UpdateKind = ukInsert then DeltaDS.FieldByName('ID_CIUDAD').NewValue := NuevoID(Varios); end;
En el lado cliente uso un TDSProviderConnection para conectar el ClientDataset con el proveedor del servidor, he dispuesto un Timer que cada segundo inserta un regsitro (vía ApplyUpdates) y se inhabilita en caso de excepción, se conecta bien, hace todo lo esperado, el problema surge cuando abro otro u otros clientes y ejecuto el timer, entonces insertan unos cuantos registros y se bloquean clientes y servidor.
Tambien he hecho la prueba escribiendo un metodo que hace el proceso de inserción de la tabla ciudades y la actualización de las otras dos tablas (sin usar el TDatasetProvider), y lo ejecuto desde el cliente vía Proxy, y ocurre exactamente lo mismo.
Espero haberme explicado.
Preguntas:
Porqué ocurre esto?
Que estoy haciendo mal?
Es factible colocar algo al llamar ApplyUpdates o al llamar el metodo via proxy para que en caso de encontrar problemas diferentes (a claves o constrains) no bloquee el cliente ni el servidor?
De antemano muchas gracias por su ayuda.