Exemplo n.º 1
0
        private void AddClassBtn_Click(object sender, EventArgs e)
        {
            DAOs.ClassBase.DAOclassBase adicionar = new DAOs.ClassBase.DAOclassBase();

            adicionar.ClasseNome = TxtBxClassName.Text;
            adicionar.Strengh    = Convert.ToInt32(TxtBxClassStr.Text);
            adicionar.Intell     = Convert.ToInt32(TxtBxClassIntell.Text);
            adicionar.Charisma   = Convert.ToInt32(TxtBxClassChar.Text);
            adicionar.Speed      = Convert.ToInt32(TxtBxClassSpeed.Text);
            adicionar.HP         = Convert.ToInt32(TxtBxClassHP.Text);

            adicionar.Insert(adicionar);
        }
Exemplo n.º 2
0
        public void Insert(DAOclassBase adicionar)
        {
            try
            {
                ConnectionOpen();

                MySqlCommand query = new MySqlCommand("INSERT INTO ClassBase(ClasseNome, strengh, intelligence, charisma, speed, HP)" +
                                                      "VALUES(@classe, @strengh, @intell, @charisma, @speed, @HP)", conn);

                query.Parameters.AddWithValue("@classe", ClasseNome);
                query.Parameters.AddWithValue("@strengh", Strengh);
                query.Parameters.AddWithValue("@intell", Intell);
                query.Parameters.AddWithValue("@charisma", Charisma);
                query.Parameters.AddWithValue("@speed", Speed);
                query.Parameters.AddWithValue("@HP", HP);

                query.ExecuteNonQuery();
            }
            catch (SqlException err)
            {
                MessageBox.Show("ERRO:" + err.Message);
                ConnectionClose();
            }
        }