var tmpPicture:Tbitmap; begin if openpicturedialag.execute then tmpPicture.loadFromFile(openPictureDialag.filename); try table1.open; table1.insert; table1.fieldbyname('Picture_col').assign(tmpPicture); table1.post; finally tmpPicture.free; end; end;
var jpeg_:tjpegimage; s:tmemorystream; begin .... .... S := TMemoryStream.Create; jpeg_.loadfromfile('c:\pic.jpg'); Jpeg_.SaveToStream(S); S.Position := 0;
adoquery1.sql.clear; .add('insert into tblname pictureField=:p_image'); adoquery1.ParamByName('p_image').LoadFromStream(s,ftgraphic); adoquery1.ExecSQL; ..... ......
tmpPicture:Tbitmap;
begin
if openpicturedialag.execute then
tmpPicture.loadFromFile(openPictureDialag.filename);
try
table1.open;
table1.insert;
table1.fieldbyname('Picture_col').assign(tmpPicture);
table1.post;
finally
tmpPicture.free;
end;
end;
s:tmemorystream;
begin
....
....
S := TMemoryStream.Create; jpeg_.loadfromfile('c:\pic.jpg');
Jpeg_.SaveToStream(S);
S.Position := 0;
adoquery1.sql.clear;
.add('insert into tblname pictureField=:p_image');
adoquery1.ParamByName('p_image').LoadFromStream(s,ftgraphic);
adoquery1.ExecSQL;
.....
......