private void button1_Click(object sender, EventArgs e) { UpDateStatus("正在连接..", 100, 1); MySql.TryOpen(); MysqlAdapter = new MySqlDataAdapter(DataBase.GetSendMailString(), MySql.Connect); MySqlCommandBuilder sb1 = new MySqlCommandBuilder(MysqlAdapter); Tools.ClearTable(DataBuf.Tables["Send"]); MysqlAdapter.Fill(DataBuf, "Send"); SendMailBingding(DataBuf.Tables["Send"]); MysqlAdapter1 = new MySqlDataAdapter(DataBase.GetReceiveMailString(), MySql.Connect); MySqlCommandBuilder sb2 = new MySqlCommandBuilder(MysqlAdapter1); Tools.ClearTable(DataBuf.Tables["Receive"]); MysqlAdapter1.Fill(DataBuf, "Receive"); ReMailBingding(DataBuf.Tables["Receive"]); UpDateStatus("加载完成", 100, 100); button4.Enabled = true; MySql.TryClose(); }
private void button3_Click(object sender, EventArgs e) { MySql.CreateSqlConnet(); UpDateStatus("正在连接..", 100, 1); if (MySql.TryOpen()) { UpDateStatus("连接成功", 100, 100); button1.Enabled = true; button2.Enabled = true; button4.Enabled = true; button5.Enabled = true; button1_Click(null, null); this.Text = "用户ID:" + Value.UserId.ToString(); button3.Enabled = true; } else { UpDateStatus("连接失败", 100, 0); button1.Enabled = false; button2.Enabled = false; button4.Enabled = false; button5.Enabled = false; } }