public static void LoginThread() { MySqlDataAdapter MysqlAdapter; string Id = RegEdit.GetReg("userid"); if (Id == "") { MySql.CreateSqlConnet(); if (MySql.TryOpen()) { Value.LinkOk = true; MySqlCommand Conmand = new MySqlCommand(DataBase.InsertNewUserid(), MySql.Connect); Conmand.ExecuteNonQuery(); DataTable DT = new DataTable(); MysqlAdapter = new MySqlDataAdapter(DataBase.GetMaxIdString(), MySql.Connect); MySqlCommandBuilder msb = new MySqlCommandBuilder(MysqlAdapter); MysqlAdapter.Fill(DT); RegEdit.SetReg("userid", DT.Rows[0][0].ToString()); Value.UserId = int.Parse(DT.Rows[0][0].ToString()); MessageBox.Show("自动分配到ID:" + Value.UserId.ToString(), "提示!"); } } else { Id = RegEdit.GetReg("userid"); Value.UserId = int.Parse(Id); } }
private void button3_Click(object sender, EventArgs e) { MySql.CreateSqlConnet(); if (MySql.TryOpen()) { string Com = "update mail_users set Msg='" + @Value.Msg + "',Title='" + @Value.Title + "' where Id=" + Value.UserId; MySqlCommand Conmand = new MySqlCommand(Com, MySql.Connect); try { Conmand.ExecuteNonQuery(); } catch (Exception E) { MessageBox.Show(E.Message); } } }
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; } }