adoquery1.close;
adoquery1.sql.add('insert into 表 (图片字段) values(:pic)');
adoquery1.Parameters.ParamByName('pic').LoadFromFile('图片路径',ftGraphic);
adoquery1.ExecSQL;
adoquery1.sql.add('insert into 表 (图片字段) values(:pic)');
adoquery1.Parameters.ParamByName('pic').LoadFromFile('图片路径',ftGraphic);
adoquery1.ExecSQL;
然后用
with adotable1 do
begin
append;
dbimage1.pictrue.loadfromfile('c:\a.bmp');
post;
end;
begin
edit;
dbimage1.pictrue.loadfromfile('c:\a.bmp');
post;
end;
其实,存进去的还是路径
st: TStringStream;
begin
st := tstringstream.create('');
bitmap.savetostream(st);
query1.sql.text := 'insert into table Image_field values :bmp';
query1.parambyname('bmp').asblob := st.datastring;
query1.execsql;
st.free;
end;
Pic: TPicture;
begin
Pic := TPicture.Create;
try Pic.LoadFromFile('c:\a.bmp');
..... Table1.FieldByName('Photo').Assign(Pic);
.....
finally
FreeAndNil(Pic);
end;