GARANTIR DESCONTO

Fórum CDSUtil.pas Delphi 6 = erro #288142

14/07/2005

0

Amigos estou com o seguinte problema,

Utilizo Delphi6 + SQLQuery + DatasetProvider + ClientDataset

Quando envio minhas atualizacoes atravez do medoto ApplyUpdates tudo funciona corretamente. ClientDataset.ApplyUpdates(0);

Mas quando preciso utilizar a unit para se enviar atualizacoes de varias ClientDatasets de uma vez no contexto de uma transacao o mesmo gera um erro:


   {Delta is the CDS.Delta on input. On return, Delta will contain a data packet}
{containing all of the records that could not be applied to the database.}
{Remember Delphi 5 needs the provider name, and this is passed in the 1 element}
{of the AProvider variant.}
procedure ApplyDelta(AProvider: OleVariant; var Delta : OleVariant);
var
  ErrCount : integer;
  OwnerData: OleVariant;
begin
  if not VarIsNull(Delta) then
  begin
    // ScktSrvr does not support early-binding
{$IFDEF VER130}
    Delta := (IDispatch(AProvider[0]) as IAppServer).AS_ApplyUpdates(AProvider[1], Delta, 0, ErrCount, OwnerData);
{$ELSE}
    [b]Delta := OleVariant(IDispatch(AProvider)).ApplyUpdates(Delta, 0, ErrCount);[/]
{$ENDIF}
    if ErrCount > 0 then
      SysUtils.Abort;  // This will cause Rollback in the calling procedure
  end;
end;




No Delphi 6 tenho que modificar o codigo acima, pois no Delphi 5 funcionava perfeitamente.

Obrigado a todos.


Sergiomatos

Sergiomatos

Responder

Posts

15/07/2005

Sergiomatos

Problema resolvido.

alterei o codigo para:

Delta := (IDispatch(AProvider[0]) as IAppServer).AS_ApplyUpdates (AProvider[1], Delta, 0, ErrCount, OwnerData);

removendo os testes de versão do delphi e deixando como estava funcionando no D5


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar