Board index » delphi » Save Variant to Blob Field ?

Save Variant to Blob Field ?

Hey Everyone !

I am trying to save a blob function return into a MSAccess database ( or
any other ).

My test code works fine :

Var  MyBlob : Variant;
Begin
   MyBlob := MapInformation.SaveOCXStateToBlob;
   MapInformation.LoadOCXStateFromBlob(MyBlob);
End;

But, when I save it to a field :

Begin
   Table_.Edit;
   Table_SaveBlob.AsVariant := MapInformation.SaveOCXStateToBlob;
   Table_.Post;
   MapInformation.LoadOCXStateFromBlob(Table_SaveBlob.AsVariant);
End;

I get a "Not a Blob (VT_UI1) Variant".  I haven't found documentation for
error.

What's Up!  Please Help ( Project as deadline ).

Thanks, Mike

 

Re:Save Variant to Blob Field ?


Quote
Mike Horsley wrote:

> Hey Everyone !

> I am trying to save a blob function return into a MSAccess database ( or
> any other ).

> My test code works fine :

> Var  MyBlob : Variant;
> Begin
>    MyBlob := MapInformation.SaveOCXStateToBlob;
>    MapInformation.LoadOCXStateFromBlob(MyBlob);
> End;

> But, when I save it to a field :

> Begin
>    Table_.Edit;
>    Table_SaveBlob.AsVariant := MapInformation.SaveOCXStateToBlob;
>    Table_.Post;
>    MapInformation.LoadOCXStateFromBlob(Table_SaveBlob.AsVariant);
> End;

> I get a "Not a Blob (VT_UI1) Variant".  I haven't found documentation for
> error.

> What's Up!  Please Help ( Project as deadline ).

> Thanks, Mike

Have you tried using implementation of TDataSet, the underlying class
for dataset comps? For example:
Data.Fields[1].Value

TBlobField property "Value" reads/writes directly to blob field
components.

Steve

Other Threads