修改ADOConnection的ConnectionString就行了
我是这样实现的
const
ConnectStr='Provider=SQLOLEDB.1;Password=%s;Persist Security Info=True;'+
'User ID=%s;Initial Catalog=%s;Data Source=%s';
begin
..
FailureRepDataModule.adocntRelFracas.ConnectionString:=Format(ConnectStr,
[sPassword,sUserName,sDatabaseName,sServerName]);
adocntRelFracas.Connected:=True;