T
tlldelphi
Unregistered / Unconfirmed
GUEST, unregistred user!
我想通过sql语句存取jpg图像,在网上看到了以下代码(做了一下修改),但出现错误了:update语法错误。怎么回事呢?请各位帮忙
各位如果有此方面的解决方法,请给出,谢谢了
var
M:TMemoryStream;
begin
if OpenPictureDialog1.Execute then
begin
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;
if Application.MessageBox('是否存入数据库?','提示',MB_OKCANCEL)<>1 then Exit;
M:=TMemoryStream.create;
Image1.Picture.graphic.SaveToStream(M);
M.Position:=0;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='update 1 set image=:image where id=:id';
adoquery1.Parameters.ParamByName('id').value:='123';
ADOQuery1.Parameters.ParamByName('image').LoadFromStream(M,ftBlob);
ADOQuery1.Prepared;
ADOQuery1.ExecSQL;
M.Free;
end;
各位如果有此方面的解决方法,请给出,谢谢了
var
M:TMemoryStream;
begin
if OpenPictureDialog1.Execute then
begin
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;
if Application.MessageBox('是否存入数据库?','提示',MB_OKCANCEL)<>1 then Exit;
M:=TMemoryStream.create;
Image1.Picture.graphic.SaveToStream(M);
M.Position:=0;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='update 1 set image=:image where id=:id';
adoquery1.Parameters.ParamByName('id').value:='123';
ADOQuery1.Parameters.ParamByName('image').LoadFromStream(M,ftBlob);
ADOQuery1.Prepared;
ADOQuery1.ExecSQL;
M.Free;
end;