Salve, galera. To usando rad 2010, zeos7 e postgresql 8. No bd criei um campo foto do tipo bytea. No form coloquei um OpenPictureDialog e um buttom para carregar uma imagem (jpg). O código do buttom:
procedure TfrmAlunos.SpeedButton1Click(Sender: TObject); var FileStream : TFileStream; BlobStream : TStream; begin inherited; if not (dtsCadastro.DataSet.State in ([dsEdit, dsInsert])) then dtsCadastro.DataSet.Edit; if OpenPictureDialog1.Execute then begin FileStream:=TFileStream.Create(OpenPictureDialog1.FileName, fmOpenRead or fmShareDenyWrite); BlobStream:=dtsCadastro.DataSet.CreateBlobStream(dmOPR.cds_alunofoto, bmWrite); try BlobStream.CopyFrom(FileStream,FileStream.Size); finally FileStream.Free; BlobStream.Free; end; end; end; Tenho também um image para mostrar a foto e no onchange do dtsCadastro(datasource): var BlobStream : TStream; JPEGImage : TJPEGImage; begin inherited; if dmOPR.cds_alunofoto.BlobSize <> 0 then begin BlobStream:= dtsCadastro.DataSet.CreateBlobStream(dmOPR.cds_alunofoto, bmRead); JPEGImage:= TJPEGImage.Create; try JPEGImage.LoadFromStream(BlobStream); Image1.Picture.Assign(JPEGImage); finally BlobStream.Free; JPEGImage.Free end; end else Image1.Picture:=nil; end; Bom, carrega a imagem normal e mostra no image sem problemas, só que não grava os dados no bd. Olhando o log, retorna isso: Postgres NOTICE, msg: AVISO: uso de \\ fora do padrão em cadeia de caracteres at character 229 HINT: Utilize a sintaxe de escape de cadeia de caracteres para barras invertidas, i.e., E'\\'. Como posso resolver isto? []'s Stclara.