Forum > Databases

TBufferDataSet List Index -1 out bounds on locate

(1/1)

eldonfsr:
I confuse  i crate a tbufferdataset ans start to add record i add only new record and validate if record exist on second record send me error.....

using locate but send me this error, just on
BDCarCli.Locate('numcli', SQLQRep.FieldByName('NumCli').AsString , [])

send me error....


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---   BDCarCli.Open;    SQLQRep.First;    while( not SQLQRep.EOF) do begin       if not BDCarCli.Locate('numcli', SQLQRep.FieldByName('NumCli').AsString , []) then begin          BDCarCli.Append;          BDCarCli.FieldByName('NumCli').AsString:= SQLQRep.FieldByName('NumCli').AsString;          BDCarCli.FieldByName('NomCli').AsString:= SQLQRep.FieldByName('NomCli').AsString;       end else begin         BDCarCli.edit;       end;       if( SQLQRep.FieldByName('Dias').AsInteger<0) then begin         BDCarCli.FieldByName('PorVencer').AsFloat:=BDCarCli.FieldByName('PorVencer').AsFloat+ SQLQRep.FieldByName('Saldodoc').AsFloat;       end;       if( (SQLQRep.FieldByName('Dias').AsInteger>0) and(SQLQRep.FieldByName('Dias').AsInteger<=30) ) then begin         BDCarCli.FieldByName('Vdo0a30').AsFloat:= BDCarCli.FieldByName('Vdo0a30').AsFloat+SQLQRep.FieldByName('Saldodoc').AsFloat;       end;       if( (SQLQRep.FieldByName('Dias').AsInteger>30) and(SQLQRep.FieldByName('Dias').AsInteger<=60) ) then begin         BDCarCli.FieldByName('Vdo30a60').AsFloat:= BDCarCli.FieldByName('Vdo30a60').AsFloat+SQLQRep.FieldByName('Saldodoc').AsFloat;       end;       if( (SQLQRep.FieldByName('Dias').AsInteger>60) and(SQLQRep.FieldByName('Dias').AsInteger<=90) ) then begin         BDCarCli.FieldByName('Vdo60a90').AsFloat:= BDCarCli.FieldByName('Vdo60a90').AsFloat+SQLQRep.FieldByName('Saldodoc').AsFloat;       end;       if( (SQLQRep.FieldByName('Dias').AsInteger>90)  ) then begin         BDCarCli.FieldByName('VdoMas90').AsFloat:= BDCarCli.FieldByName('VdoMas90').AsFloat+SQLQRep.FieldByName('Saldodoc').AsFloat;       end;       BDCarCli.FieldByName('Saldo').AsFloat:= BDCarCli.FieldByName('Saldo').AsFloat+SQLQRep.FieldByName('Saldodoc').AsFloat;       BDCarCli.post;       SQLQRep.next;    end;  

eldonfsr:
I solved i change to use MemDataset and is working......

Navigation

[0] Message Index

Go to full version