براي اينكار شما محتويات عكس كه به شكل باينري يا Stream هست رو به رشته اي از Hex تبديل كن
function GetBitmapHexString(aBitmap: TBitmap): string;
var
ms: TStream;
i: integer;
b: byte;
begin
Result := '';
ms := TMemoryStream.Create;
try
aBitmap.SaveToStream(ms);
ms.Position := 0;
for i := 1 to ms.Size do
begin
ms.Read(b, 1);
Result := Result + IntToHex(b, 2);
end;
finally
ms.Free;
end;
if Result <> '' then
Result := '0x' + Result;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
HexString: string;
begin
HexString := GetBitmapHexString(Image1.Picture.Bitmap);
if HexString = '' then
HexString := 'NULL';
qry1.sql.add('insert into cars (name, type, pic) valeus(''BMW'', 1, ' + HexString + ')');
end;