G
gcq
Unregistered / Unconfirmed
GUEST, unregistred user!
<font color=red>用TClientDataSet存取图象、OLE的问题!(SOS)(别处有分)</font> <font color=blue>150大洋</font> (0分)<br />var
tiDataSet:TClientDataSet;
tiSqlStr:string;
imgStream:TMemoryStream;
begin
imgStream:=TMemoryStream.Create;
imgFlag.Picture.Bitmap.SaveToStream(imgStream);//imgFlag为TImage
imgStream.Position := 0;
tiSqlStr := 'SELECT CORP_FLAG FROM COMPANY_INFO WHERE ID=1';
。。。。。。
if not tiDataSet.isempty then
begin
//存流
tiDataSet.CommandText := 'UPDATE COMPANY_INFO SET CORP_FLAG=:A WHERE ID=1';
tidataset.Params.CreateParam(ftBlob, 'A', ptInput).LoadFromStream(imgStream,ftBlob);
tiDataSet.Execute;
showmessage(inttostr(imgstream.size)); //Size=17594
//输出到流
imgStream.Clear;
TBlobField(tidataSet.fieldbyname('CORP_FLAG')).savetostream(imgstream);
end;
end;
end;
showmessage(inttostr(imgstream.size));//Size=15537
imgStream.Free;
end;
请问众位大虾,如何才能正确存取?
不要说用别的什么类或查什么ID(我已经查过了)!目前只能用TClientDataSet
希望大家踊跃提出见解,小弟在此先多谢各位了!分不够再加!
有高手会的,请贴出代码或发
gcqmail@sohu.com
<font color=red>有兴趣者到</font>
<A
href="http://www.delphibbs.com/delphibbs/DispQ.asp?LID=369962">SOS</A>
tiDataSet:TClientDataSet;
tiSqlStr:string;
imgStream:TMemoryStream;
begin
imgStream:=TMemoryStream.Create;
imgFlag.Picture.Bitmap.SaveToStream(imgStream);//imgFlag为TImage
imgStream.Position := 0;
tiSqlStr := 'SELECT CORP_FLAG FROM COMPANY_INFO WHERE ID=1';
。。。。。。
if not tiDataSet.isempty then
begin
//存流
tiDataSet.CommandText := 'UPDATE COMPANY_INFO SET CORP_FLAG=:A WHERE ID=1';
tidataset.Params.CreateParam(ftBlob, 'A', ptInput).LoadFromStream(imgStream,ftBlob);
tiDataSet.Execute;
showmessage(inttostr(imgstream.size)); //Size=17594
//输出到流
imgStream.Clear;
TBlobField(tidataSet.fieldbyname('CORP_FLAG')).savetostream(imgstream);
end;
end;
end;
showmessage(inttostr(imgstream.size));//Size=15537
imgStream.Free;
end;
请问众位大虾,如何才能正确存取?
不要说用别的什么类或查什么ID(我已经查过了)!目前只能用TClientDataSet
希望大家踊跃提出见解,小弟在此先多谢各位了!分不够再加!
有高手会的,请贴出代码或发
gcqmail@sohu.com
<font color=red>有兴趣者到</font>
<A
href="http://www.delphibbs.com/delphibbs/DispQ.asp?LID=369962">SOS</A>