示例#1
0
文件: AddForm.cs 项目: cd547/Mysqldb1
 private void AddForm_Load(object sender, EventArgs e)
 {
     if (mysql_Db.Test_Conn() == "Open")
     {
         //  testans = "连接成功!";
         this.label2.ForeColor = Color.Green;
         this.label2.Text      = "连接成功!";
     }
     else
     {
         //  testans = "连接失败!";
         this.label2.ForeColor = Color.Red;
         this.label2.Text      = "连接失败!";
     }
 }
示例#2
0
文件: Form1.cs 项目: cd547/Mysqldb1
        public bool test()
        {
            mysql_Db = new Mysql_db(this.Server_TxtBox.Text, this.Uid_TxtBox.Text, this.PWD_TxtBox.Text, "db");
            string testans = mysql_Db.Test_Conn();

            if (testans != "Open")
            {
                //  testans = "连接失败!";
                this.TestConnect_label.ForeColor = Color.Red;
                return(false);
            }
            else
            {
                //  testans = "连接成功!";
                this.TestConnect_label.ForeColor = Color.Green;
                return(true);
            }
        }