如何显示装有SQL SEVER2000的机器名
如有三台电脑a,b,c,a和b装有SQL SEVER2000,如何在一个列表里显示a和b?
: qiubolecn(来自差生市)
两个方法,一个是用
netenumserver
它的servertype为SV_TYPE_SQLSERVER
二是用
procedure TForm1.Button1Click(Sender: TObject);
var
SQLServer:Variant;
ServerList:Variant;
i,nServers:integer;
sRetValue:String;
begin
SQLServer := CreateOleObject('SQLDMO.Application');
ServerList:= SQLServer.ListAvailableSQLServers;
nServers:=ServerList.Count;
for i := 1 to nservers do
ListBox1.Items.Add(ServerList.Item(i));
SQLServer:=NULL;
serverList:=NULL;
end;