就几行程序,上面的应该说的很清楚了
简单贴一段我的程序吧,
procedure TKHJFActiveForm.Set_ConnectionStr(const Value: WideString);
begin
ConnectionStr := Value;
ConnectDB(Value);
end;
procedure TKHJFActiveForm.ConnectDB(S: string);
begin
KHDataModule := TKHDataModule.Create(self);
with KHDataModule.ADOConnection do
begin
Close;
ConnectionString := S;
end;
end;