using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Windows;
using System.Windows.Forms;
using System.Collections;
namespace WindowsApplication1
{
class Class1
{
ProgressBar PBar;
//取得数据库服务器列表:
public ArrayList GetServerList()
{
ArrayList alServers = new ArrayList() ;
SQLDMO.Application sqlApp = new SQLDMO.ApplicationClass() ;
try
{
SQLDMO.NameList serverList = sqlApp.ListAvailableSQLServers() ;
for(int i = 1;i<= serverList.Count;i++)
{
alServers.Add(serverList.Item(i)) ;
}
}
catch (Exception e)
{
throw (new Exception("取数据库服务器列表出错:" + e.Message));
}
finally
{
sqlApp.Quit();