user jpeg;
procedure Tf_position.btn_loadpicClick(Sender: TObject);
var
i:tbitmap;
j:tjpegimage;
begin
i:=tbitmap.Create;
j:=tjpegimage.Create;
if openpicturedialog1.Execute then
begin
if uppercase(extractfileext(openpicturedialog1.FileName))='.JPG' then
begin
j.LoadFromFile(openpicturedialog1.FileName);
i.Assign(j);
end
else if uppercase(extractfileext(openpicturedialog1.FileName))='.BMP' then
begin
i.LoadFromFile(openpicturedialog1.FileName);
end
else
begin
application.MessageBox('格式错误!',pchar(application.Title),mb_ok+mb_iconinformation);
end;
end;
if not(adoquery1.State in [dsedit,dsinsert]) then adoquery1.Edit;
adoquery1.Fields[3].assign(i);
//或者用tblobfield(adoquery1.fieldvalue[image']).assign(i);
adoquery1.post;
i.Free;
j.Free;
end;