1、获取本机的SQL Server服务器名
private void Form2_Load(object sender, EventArgs e){listBox1.Items.Clear();SQLDMO.Application SQLServer = new SQLDMO.Application();SQLDMO.NameList strServer = SQLServer.ListAvailableSQLServers();if (strServer.Count > 0){for (int i = 0; i < strServer.Count; i++){listBox1.Items.Add(strServer.Item(i + 1));}}}