首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

sqlquery能用update语句更改数据库里的数据流么?解决方法

2012-05-09 
sqlquery能用update语句更改数据库里的数据流么?代码没贴全,图片已经存到MS这个内存流里了,输出到桌面正常

sqlquery能用update语句更改数据库里的数据流么?
代码没贴全,图片已经存到MS这个内存流里了,输出到桌面正常显示,但就是插入到数据库里的时候出现内存错误
请问大大们怎么回事?

Delphi(Pascal) code
function TServerMethods1.UploadPic(uName: string; uPortrait: TStream): Boolean;var  MS: TMemoryStream;      MS.CopyFrom(Stream, 0);      MS.Position := 0;      MS.SaveToFile('c:\users\fky\desktop\123.bmp');          try      with sqlqry_Pic do      begin        Close;        SQL.Clear;        SQL.Add('update t_User set u_Portrait = :p_Portrait where u_Name = :p_Name');        运行到这里出现内存错误        TBlobField(Params.ParamByName('p_Portrait')).LoadFromStream(MS);        Params.ParamByName('p_Name').Value := uName;        ExecSQL(False);        Result := True;      end;    except      Result := False;    end;


[解决办法]
保存前 MS.Position := 0;

热点排行