Board index » delphi » How do I use SetData(Buffer:Pointer) for TBlobField properly?

How do I use SetData(Buffer:Pointer) for TBlobField properly?

I can't figure out how to save data to a TBlobField!

I have a buffer, say of 100 bytes. (could be thousands though!)

Var
  Blob : TBlobField;
  Buffer : Pointer;
....
GetMem(Buffer,100);
...
( Move data into the buffer variable here... )
...
Blob:=MainForm.CustomerTable.FieldByName('Zones');

{ above code works fine... }

So then to save data:
Blob.SetData(Buffer);

But...How does delphi know the size of buffer or how much to save? If
I finally get to save some data, How could I save data that may be
larger or smaller than the current data?

I can't change any of the size properties of the TBlobField, like
writing to Blob.DataSize (error = read-only), and I can't write to
Blob.Size (error = can't change on an open dataset).

I find Borland Delphi Help very poor, and full of mistakes, anyone
else agree?

Colin MacKenzie
Silicon Electronics
Metro Halifax, Nova Scotia, Canada
(902) 864-3982

 

Re:How do I use SetData(Buffer:Pointer) for TBlobField properly?


Quote
Colin MacKenzie wrote:

> I can't figure out how to save data to a TBlobField!

> I have a buffer, say of 100 bytes. (could be thousands though!)

> Var
>   Blob : TBlobField;
>   Buffer : Pointer;
> ....
> GetMem(Buffer,100);
> ...
> ( Move data into the buffer variable here... )
> ...
> Blob:=MainForm.CustomerTable.FieldByName('Zones');

> { above code works fine... }

> So then to save data:
> Blob.SetData(Buffer);

> But...How does delphi know the size of buffer or how much to save? If
> I finally get to save some data, How could I save data that may be
> larger or smaller than the current data?

> I can't change any of the size properties of the TBlobField, like
> writing to Blob.DataSize (error = read-only), and I can't write to
> Blob.Size (error = can't change on an open dataset).

> I find Borland Delphi Help very poor, and full of mistakes, anyone
> else agree?

> Colin MacKenzie
> Silicon Electronics
> Metro Halifax, Nova Scotia, Canada
> (902) 864-3982

i have to agree with the statement about the tech support. definitely
needs work. I get better answers on usenet and chat than tech support.

Other Threads