You use LoadFromStream and SaveToStream on the Bitmap class.

On the database size reading is easy - as you will get a blob field -
which has a SaveToStream method.

You prob need to translate the stream, or use a TStringStream, as then
can read it from the image and save to a blob field or a parameter.

The other way is to translate it into a one dimensional variant byte
array for assigning to either a field or parameter.

e.g

function BufferToVarArray( Buffer: Pointer; Size: Integer ): Variant;
var
  PData: Pointer;
begin
  Result := VarArrayCreate( [0, Size-1], varByte);
  PData  := VarArrayLock(Result);
  try
    Move( Buffer^, PData^, Size);
  finally
    VarArrayUnlock(Result);
  end;
end;

Myles.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Dave O'Brien
Sent: Friday, 8 June 2007 02:26
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] SQL Server Image Type

Hi all, I have an image in a TBitmap, can't work out how to store it
(probably retrieve it as well...) in an SQL Server 2000 Image field. Any
ideas?

Regards,
Dave.

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject:
unsubscribe

Attention:
This communication is confidential and may be legally privileged.  If you are 
not the intended recipient, please do not use, disclose, copy or distribute it, 
other than to return it to us with your confirmation that it has been deleted 
from your system.

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

Reply via email to