Range Check error when user clears a datWideMemo field

Hi,

When a user clears the contents of a datWideMemo field that is exposed through data-aware controls it causes a Range Check Error. The user clears this field just by backspacing through the text until there’s none left, a moment later this error appears.

exception class : ERangeError
exception message : Range check error.

Call stack:
uDAMemDataset 5681 +8 TDABlobStream.Write
System.Classes 8815 +3 TStream.WriteBuffer
Data.DB 9073 +3 TBlobField.SetData
Data.DB 9064 +0 TBlobField.SetAsBytes
Data.DB 9052 +1 TBlobField.SetAsWideString
Data.DB 9245 +1 TWideMemoField.SetVarValue
Data.DB 5534 +5 TField.SetAsVariant

It only seems to affect one field in a particular table. Unfortunately that table is used in several parts of my application.

Any idea what might be the issue here ?

Thanks

Hi,

try to update code like

{$IFDEF DELPHIXE3UP}
function TDABlobStream.Write(const Buffer: TBytes; Offset, Count: Longint): Longint;
..
    if Count > 0 then   // <<< added
       Move(Buffer[Offset], buf[FPosition], Count);
    FDataset.SetBlobData(FField, FBuffer, buf);

will it remove that error?

Hi Evgeny,

Yes that seems to have sorted the problem - thanks

Stuart