>From some Delphi 1 app that I know works....
procedure PostToTable( var Buff: array of byte; iBuffLen: integer);
var
blobby : TBlobStream;
begin
q.Open;
q.Append;
q.FieldByName('ID').AsInteger := iMagicNo;
...
blobby := TBlobStream.Create( TBlobField(q.FieldByName('Data')), bmWrite
);
blobby.Write(Buff,BuffLen);
q.Post;
end;
I have now noticed that that BS is not freed in the actual code... mmmh.
The data is read by calling the function below with:
CopyBlobData( ARec, sizeof(ARec), TBlobField(q.FieldByName('Data')));
//ARec could be an array of bytes.
{ copies the blobs data into the passed "Dest" buffer }
function CopyBlobData( var Dest; Len: longint; ABlob: TBlobField ): boolean;
var
BlobStream: TBlobStream;
begin
BlobStream := TBlobStream.Create( ABlob, bmRead );
BlobStream.Read( Dest, Len );
BlobStream.Free;
BlobStream := nil;
result := true;
end;
-----Original Message-----
From: Colin R Dillicar [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 7 June 2000 19:27
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Streaming Data to/from BLOBs
Despite a few replies to my earlier request for help I am still none the
wiser. Most replies have steered me to the Help topics which mostly deal
with Memo fields , certainly in respect of examples. If I understood exactly
what was going on I wouldn't have asked and would not be embarrassed by
asking again. I am embarrassed, I am probably rather dim - OK !
I am having difficulty passing information between a BLOB field in a
database and an array in memory and would appreciate it if someone familiar
with the process would provide me with some sample code.
The array I have is "Program Data", as follows :-
type
DataLocations = record
Data : array[1..6] of byte;
end;
var
ProgramData : array 1..200 of DataLocations;
Even ignoring the above record definition, I have approximately 1024 bytes
of data that I want to pass back and forth between memory and one of a
number of Numeric (BLOB) fields in Paradox table. What I need is a clip of
code that does that sort of thing with a brief explanation of what's going
on. I'm sure that from then on I'll grasp the method.
Any help would be greatfully appreciated.
TIA
Colin
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz