G
gcq
Unregistered / Unconfirmed
GUEST, unregistred user!
<font color=red>用TClientDataSet存取图象、OLE的问题!(SOS)</font> <font color=blue>150大洋</font> (100分)<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)); //<font color=red>Size=17594</font>
//输出到流
imgStream.Clear;
TBlobField(tidataSet.fieldbyname('CORP_FLAG')).savetostream(imgstream);
end;
end;
end;
showmessage(inttostr(imgstream.size));//<font color=red>Size=15537</font>
imgStream.Free;
end;
请问众位大虾,如何才能正确存取?
<font color=blue>不要说用别的什么类或查什么ID(我已经查过了)!目前只能用TClientDataSet</font>
希望大家踊跃提出见解,小弟在此先多谢各位了!分不够再加!
有高手会的,请贴出代码或发
<A
href="mailto:gcqmail@sohu.com">gcqmail@sohu.com</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)); //<font color=red>Size=17594</font>
//输出到流
imgStream.Clear;
TBlobField(tidataSet.fieldbyname('CORP_FLAG')).savetostream(imgstream);
end;
end;
end;
showmessage(inttostr(imgstream.size));//<font color=red>Size=15537</font>
imgStream.Free;
end;
请问众位大虾,如何才能正确存取?
<font color=blue>不要说用别的什么类或查什么ID(我已经查过了)!目前只能用TClientDataSet</font>
希望大家踊跃提出见解,小弟在此先多谢各位了!分不够再加!
有高手会的,请贴出代码或发
<A
href="mailto:gcqmail@sohu.com">gcqmail@sohu.com</A>