取的域服务器名
procedure Tfrm_login.FormCreate(Sender: TObject);
var
domain,computer:tstringlist;
i:integer;
begin
cmbx_choose.Clear;
domain:=tstringlist.Create;
computer:=tstringlist.Create;
GetServerList(domain);
//cmbx_choose.Items:=domain;
cmbx_choose.Items.Add(f_GetComputerName+' (本机)');
for i:=0 to domain.Count-1 do
begin
cmbx_choose.Items.Add(domain);
end;
cmbx_choose.ItemIndex:=0;
pnl_choose.Visible:=false;
height:=260;
end;
用sqldmo获得
procedure Tfrmmain.FormCreate(Sender: TObject);
var
app:_application;
i:integer;
nl:namelist ;
begin
app:=coapplication.Create;
nl:=app.ListAvailableSQLServers;
cmbsqlname.Clear;
for i:=0 to nl.Count-1 do
begin
cmbsqlname.Items.Add(nl.Item(i+1) )
end;
cmbsqlname.ItemIndex:=0;
end;