Midware TMWBuffer.WriteStreamField
Jump to navigation
Jump to search
Main page -> Midware component reference -> TMWBuffer -> WriteStreamField
Definition
procedure WriteStreamField(NewRec:Boolean;FldType:TMWFieldType;Data:TStream);
Description
Write a single stream (blob) field. This function can be used to place a complete file (for example a BMP file) into a single field.
Example
<syntaxhighlight lang="delphi">
var Data : TStream;
begin
Data := TFileStream.Create(FileName, fmOpenRead + fmShareDenyNone); Data.Seek(0, 0); MWBuffer1.WriteFields(TRUE, [FileName]); MWBuffer1.WriteStreamField(FALSE, mwString, Data);
Data.Destroy; ... ...
end; </syntaxhighlight> This code will append a record to MWBuffer1 with two fields. The first will contain a file name, the second will contains the complete file. The file is loaded into the field as a blob using a file stream.