建议改造delphi自带的一个窗体,完成你需要的功能
文件名称 AdoConEd.pas,自己查找吧。另外还要一段代码
function TMainForm.EditConnectionString(AComponent: TComponent): Boolean;
var
PropInfo: PPropInfo;
NewConnStr,
InitialConnStr: WideString;
begin
Result := False;
with TConnEditForm.Create(Application) do
try
caption := 'dsfasdfasdfasdf';
PropInfo := GetPropInfo(AComponent.ClassInfo, 'ConnectionString');
InitialConnStr := GetStrProp(AComponent, PropInfo);
NewConnStr := Edit(InitialConnStr);
if NewConnStr <> InitialConnStr then
begin
SetStrProp(AComponent, PropInfo, NewConnStr);
Result := True;
end;
finally
Free;
end;
end;