DeWeb - 主动连接数据库FDConnection
procedure TForm1.Button1Click(Sender: TObject);
var
oForm : TForm;
oFDConn : TFDConnection;
iItem : Integer;
begin
oForm := Screen.Forms[0];
for iItem := 0 to oForm.ComponentCount - 1 do begin
if oForm.Components[iItem].ClassName = 'TFDConnection' then begin
oFDConn := TFDConnection(oForm.Components[iItem]);
if not oFDConn.Connected then begin
oFDConn.Open;
end;
end;
end;
//dwShowMessage('success',self);
end;

浙公网安备 33010602011771号