标签:style blog http io os ar for sp 数据
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)); } } }
private void button1_Click(object sender, EventArgs e) { DBUser.sserver = "."; DBUser.DBName = "Goodluck"; DBUser.suser = "sa"; DBUser.spasswd = "abc"; MyDBase DB = new MyDBase(DBUser.sserver, DBUser.DBName, DBUser.suser, DBUser.spasswd); DataSet DS = DB.GetRecordset("use master;select name as Sname from sysdatabases"); comboBox1.DataSource = DS.Tables[0]; comboBox1.DisplayMember = "Sname"; comboBox1.ValueMember = "Sname"; DB.DBClose(); }
标签:style blog http io os ar for sp 数据
原文地址:http://blog.csdn.net/lucky51222/article/details/40583607