Re: Saving a array of bytes using ADO
From: yc (yc_at_yc.yc)
Date: 02/18/05
- Next message: Jeff Howard: "TAdoData1 DataSource"
- Previous message: Dennis: "Re: Where can TBetterADODataset downloaded ?"
- In reply to: yc: "Saving a array of bytes using ADO"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 18 Feb 2005 07:41:04 -0800
Don't worry, I figured it out.
And show you how it is done.
Let's say table have a qry and Memo field called MEM_FLD
Write
-----
var
Stream: TStream;
bf : TBlobByteData;
rc, i : Integer;
begin
rc := 100;
SetLength(bf, rc);
for i := Low(bf) to High(bf) do
begin
bf[i] := i;
end;
qry.Edit;
try
Stream := qry.CreateBlobStream(qry.FieldByName('MEM_FLD') as TBlobField, bmWrite);
try
i := Stream.Write(bf[0], rc);
finally
Stream.Free;
end;
except
qry.Cancel;
raise;
end;
qry.Post;
Read
-----
var
bf : TBlobByteData;
rc : Integer;
begin
rc := qry.GetBlobFieldData(qry.FieldByName('MEM_FLD').FieldNo, bf); //Returns # of bytes read
end;
"yc" <yc@yc.yc> wrote:
>
>I have a access (mdb) file with the following table and field features.
>TEST_TABLE
> a Text(128)
>
>In my Delphi appl. I would like to be able to save a byte array of 128. ( var a : array[0..127] of byte;)
>In TADOQuery component there is no way of saving an array of bytes. If I manage this for mdb I think I can use the same technique for other DB using ADO components.
>
>Is there any way of doing this ?
>If yes, how ?
>A code snippet is appreciated.
>Thanks in advance
>yc
>
- Next message: Jeff Howard: "TAdoData1 DataSource"
- Previous message: Dennis: "Re: Where can TBetterADODataset downloaded ?"
- In reply to: yc: "Saving a array of bytes using ADO"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|