Java教程

在创建窗口时,对需要进行数据库连接的控件进行初始化,或者在数据模块中,非常有用

本文主要是介绍在创建窗口时,对需要进行数据库连接的控件进行初始化,或者在数据模块中,非常有用,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

ComponentCount--组件数量

for i:=0 to ComponentCount-1 do   //对窗口组件进行遍历

begin

  if self.Components[i] is TFDQuery then

  begin

    (self.Components[i] as TFDQuery).Connection:=Conn;

    (self.Components[i] asTFDQuery).FetchOptions.Mode:=fmAll;

  end else

  if self.Components[i] is TFDStoredProc then

  begin

    (self.Components[i] as TFDStoredProc).Connection:=Conn;

  end else

  if self.Components[i] is TDBGridEh then

  begin

    (self.Components[i] as TDBGridEh).EvenRowColor:=clWindows;

    (self.Components[i] as TDBGridEh).OddRowColor:=$00FDFDF4;

  end;

end;

 

这篇关于在创建窗口时,对需要进行数据库连接的控件进行初始化,或者在数据模块中,非常有用的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!