Board index » delphi » Need help: BLOB trouble

Need help: BLOB trouble

I am trying to store information in a Paradox 7 Binary field (TBlobField
in Delphi)

I declared a record:

  WhatInfoRec = Record
    Quantity : Word;
    IsColor  : Boolean;
    Name     : String[25];
  end;

Then:

 Var
    WhatInf : WhatInfoRec;

When I try to do something like:

MyBlodField.AsVariant := WhatInf;

I get a invalid typecast error. I understand what the error means, but I
need to find a way around it.
I typed type casting WhatInf as a String or Array
[1..Sizeof(WhatInfoRec) or byte;
But nothing work.

Please send me any ideas.

Erez Steinberg
ere...@ibm.net

 

Re:Need help: BLOB trouble


Create a blobstream and write the records to it

var BS: TBlobStream;
    Field: TBlobField;
begin
Field:= TBlobField(Table1.FindField(BlobFieldName));
BS:= TBlobStream.Create(TBlobField(Field), bmWrite);
Count:= BS.Write(WhatInf, SizeOf(WhatInf));
BS.free;

Paul Motyer
SoftStuff
PO Box 637, Croydon, VIC, Australia, 3136

Quote
Erez Steinberg wrote in message <35EE7429.3D4A9...@ibm.net>...
>I am trying to store information in a Paradox 7 Binary field (TBlobField
>in Delphi)

>I declared a record:

>  WhatInfoRec = Record
>    Quantity : Word;
>    IsColor  : Boolean;
>    Name     : String[25];
>  end;

>Then:

> Var
>    WhatInf : WhatInfoRec;

>When I try to do something like:

>MyBlodField.AsVariant := WhatInf;

>I get a invalid typecast error. I understand what the error means, but I
>need to find a way around it.
>I typed type casting WhatInf as a String or Array
>[1..Sizeof(WhatInfoRec) or byte;
>But nothing work.

>Please send me any ideas.

>Erez Steinberg
>ere...@ibm.net

Other Threads