This message is sent for archive reasons.
For attention to anyone interest on TDBF component.
Following two functions provide MEMO field Write and Read features to
TDBF component. These support text by now but can support any form of
data with a few modifications. I think these would be helpful,
especially to new users because I had this experience lately. Now, if
Micha agrees to include those as new methods to TDBF component, this
would be perfect.
// READ MEMO FIELD
function ReadMEMOField( tTable: TDbf; cFieldName: string;
ContainerObject: TForm ): string;
var
tsMemoStream: TStream;
pBuffer: pchar;
sMemo: string;
nCounter, nStopChar: integer;
begin
tsMemoStream := TTable.CreateBlobStream( TTable.FieldByName(
cFieldName ), bmRead );
tsMemoStream.Position := 0;
pBuffer := GetMem( tsMemoStream.Size );
tsMemoStream.read( pBuffer^, tsMemoStream.Size );
sMemo := AnsiString( pBuffer );
Result := sMemo;
Freemem( pBuffer );
tsMemostream.free;
end;
// WRITE MEMO FIELD
procedure WriteMEMOField( tTable: TDbf; cFieldName, cContent: string );
var
tsMemoStream: Tstream;
pBuffer: pchar;
begin
tsMemoStream := TTable.CreateBlobStream( TTable.FieldByName(
cFieldName ), bmWrite );
GetMem( pBuffer, AnsiLength( cContent ) + 1 );
StrPCopy( pBuffer, cContent );
tsMemoStream.Position := 0;
tsMemoStream.Write( pBuffer^, AnsiLength( cContent ) + 1 );
Freemem( pBuffer );
tsMemostream.free;
end;
Panagiotis
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives