怎么把blob字段里的内容存到IStream里去
展开全部
procedure Tfrmlr.TBtnYesClick(Sender: TObject);
var
stringstream:TStringStream;
begin
StringStream := TStringStream.Create ('');
MemQw.Lines.SaveToStream (StringStream); //在这里创建一个字符流
StringStream.Position := 0;
with Query1.SQL do
begin
Clear;
Add ('insert into oadbo.bw_qwb (wjid,Wjdid,kzm,qw)'
+ ' values (:a, 0, :b, :c)');
end;
with Query1 do
begin
ParamByName ('a').asstring :=IntToStr(nlwid);
ParamByName ('b').asstring := 'txt';
ParamByName ('c').asBlob := StringStream.DataString; //就在这里赋值
end;
StringStream.Free; //用完了马上Free掉
Query1.ExecSQL; //开始插入记录
end;
var
stringstream:TStringStream;
begin
StringStream := TStringStream.Create ('');
MemQw.Lines.SaveToStream (StringStream); //在这里创建一个字符流
StringStream.Position := 0;
with Query1.SQL do
begin
Clear;
Add ('insert into oadbo.bw_qwb (wjid,Wjdid,kzm,qw)'
+ ' values (:a, 0, :b, :c)');
end;
with Query1 do
begin
ParamByName ('a').asstring :=IntToStr(nlwid);
ParamByName ('b').asstring := 'txt';
ParamByName ('c').asBlob := StringStream.DataString; //就在这里赋值
end;
StringStream.Free; //用完了马上Free掉
Query1.ExecSQL; //开始插入记录
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询