示例#1
0
        private void AuthBtn_Click(object sender, EventArgs e)
        {
            try
            {
                string          Connection = "Server=;Port=3;Database=td;Uid=te4id;password="******"Select MyKeysI from MyKey";

                conn.Open();


                MySqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    FromMySQL += reader["MyKeysI"].ToString() + " ";
                }

                code = AuthCode.Text;

                Properties.Settings.Default["Key"] = code;
                Properties.Settings.Default.Save();

                if (FromMySQL.Contains(code) && code.Length > 20 && !FromMySQL.Contains(code + "active"))
                {
                    string          Connectiona = "Server=temah;Port=3Database=teid;Uid=tema4id;password=vkq7";
                    MySqlConnection conna       = new MySqlConnection(Connectiona);
                    MySqlCommand    commandAd   = conna.CreateCommand();
                    commandAd.CommandText = ("UPDATE `MyKey` SET `MyKeysI`= '" + code + "active' WHERE MyKeysI = '" + code + "'");
                    conna.Open();
                    commandAd.ExecuteNonQuery();

                    buttonAgain.Hide();
                    toolStripContainer1.Hide();
                    AuthBtn.Hide();
                    AuthCode.Hide();
                    TypeCode.Hide();
                    ErrorOfKey.Hide();
                    button7.Hide();
                }
                else
                {
                    BaddConnection.Hide();
                    ErrorOfKey.Show();
                }
            }
            catch
            {
                ErrorOfKey.Hide();
                BaddConnection.Show();
            }
        }