日期:2014-05-17 浏览次数:20904 次
procedure TMainForm.btnInputPhotoInfoClick(Sender: TObject);
var
bRst: Boolean;
msStream: TMemoryStream;
iSize: Int64;
begin
if img111.Picture.Graphic = nil then
begin
ShowMsg('照片不能为空');
Exit;
end;
msStream := TMemoryStream.Create;
img111.Picture.Graphic.SaveToStream(msStream);
msStream.Position := 0;
bRst := SaveReaderPhoto(Trim(edtCode112.Text),msStream);
if bRst then
begin
ShowMsg('保存照片成功');
end
else ShowMsg('保存照片失败');
FreeAndNil(msStream);
end;
function SaveReaderPhoto(const A_sBarCode: string;
A_msStream: TMemoryStream): Boolean;
begin
Result := False;
with SysDM.OraqryReaderInfoData do
begin
SQL.Text :=
'update readerinfo set reader_photo= empty_blob()' +
' where reader_barcode = :BarCode';
ParamByName('BarCode').AsString := Trim(A_sBarCode);
ExecSQL;
Close;
SQL.Text :=
'update readerinfo set reader_photo = :photo' +
' where reader_barcode = :BarCode';
ParamByName('BarCode').AsString := Trim(A_sBarCode);
A_msStream.Position := 0;
ParamByName('photo').LoadFromStream(A_msStream,ftBlob);
try
ExecSQL;
Result := True;
except
on E:Exception do
begin
WriteLog('Melinets_SaveReaderPhoto/' + E.Message);
end;
end;
Close;
end;