private void button1_Click(object sender, EventArgs e) { if (mySQLConnectionTest.testConnection()) { MessageBox.Show("连接测试成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("连接测试失败!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form1 frm = new Form1(); SQLConnConfig config = new SQLConnConfig(); if (config.testConnection()) { } else { frm.SetMenuItemsEnableStatus(false); frm.SetMsg("提示:数据库配置错误!"); } Application.Run(frm); }