Beispiel #1
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            var servername = txtServer.Text.Trim();
            var uid        = txtUser.Text.Trim();
            var pwd        = txtPwd.Text.Trim();
            var constr     = service.GetConnectioning(servername, uid, pwd);

            if (service.ConnectionTest(constr))
            {
                MessageBox.Show("连接数据库成功!");
                comboBox1.DataSource = service.GetDBNameList(constr);
            }
            else
            {
                MessageBox.Show("连接数据库失败!");
            }
        }