怎么知道当前运行的程序中间活动的打开的数据库控件有那些?因为数据控件都在datamodule中,应用的窗体关闭后,数据库控件依然处于打开的状态,很多时候控件多了,没有关闭完,很容易产生错误.
解决方案 »
- 怎样将TMemoryStream 读入到一个byte数组里面
- QuantumGrid,cxGrid如何让子表一开始处于显示状态?
- 请教一个关于框架为什么不能显示的问题
- 浮点运算错误!
- 在delphi中如何动态建立oracle的存储过程和触发器?
- 在Delphi中,如何用文件的方式来解决对象的序列化问题?
- 模式窗体怎样 返回参数。
- 关于组件服务的超难问题,好心人请进!!
- Nizvoo(瓦匠泥) 加我 qq:38311346
- 一个关于ActiveForm的问题,很头疼,大家帮帮忙!
- 如何将重载窗体的事件写成组件,在整个Application中有效?
- 如何使用代码判断是否可以连接指定IP的SQL Server???
begin
if form1.Components[i] is tadoquery then
if form1.Components[i].Active=false then
showmessage('false')
else
showmessage('true');
else
showmessage('a');
end;
end;
我想在窗体关闭的代码中加入这个代码,来观察是否有那些ado控件还没有关闭,但是用form1.components[i].这个方式,但是active这个属性没有了.
uses TypInfo, Math;
procedure ShowOpenedAdoDs(AdodsParent:TForm);
var i:integer;
v:Variant;
p:ppropinfo;
strSate:string;
begin
with AdodsParent do
begin
for i:=0 to ComponentCount-1 do
begin
begin
p:=nil;
p:=GetPropInfo(AdodsParent.Components[i],'Active');
if p<>nil then
begin
v:=GetPropValue(Components[i],'Active');
if Components[i] is TCustomADODataSet then
showmessage(TCustomADODataSet(Components[i]).Name);
end;
end;
end;
end;
end;