Example #1
0
 public void CadastrarQuestoesCinema(C_ControleQuestoesDados _questoesDados)
 {
     try
     {
         SqlCommand cmd = new SqlCommand();
         conectionDB.Conectar();
         cmd.Connection  = conectionDB.ObjetoConexao;
         cmd.CommandText = "INSERT INTO Quiz_Cinema(ID_PERGUNTA,PERGUNTA, A, B, C, D, RESPOSTA) VALUES (@ID_PERGUNTA,@PERGUNTA, @A, @B, @C, @D, @RESPOSTA)";
         cmd.Parameters.AddWithValue("@ID_PERGUNTA", _questoesDados.ID_Pergunta);
         cmd.Parameters.AddWithValue("@PERGUNTA", _questoesDados.Pergunta);
         cmd.Parameters.AddWithValue("@A", _questoesDados.QuestaoA);
         cmd.Parameters.AddWithValue("@B", _questoesDados.QuestaoB);
         cmd.Parameters.AddWithValue("@C", _questoesDados.QuestaoC);
         cmd.Parameters.AddWithValue("@D", _questoesDados.QuestaoD);
         cmd.Parameters.AddWithValue("@RESPOSTA", _questoesDados.Resposta);
         cmd.ExecuteNonQuery();
     }
     catch (SqlException error)
     {
         throw new ApplicationException(error.Message);
     }
     finally
     {
         conectionDB.Desconectar();
     }
 }
Example #2
0
        public int QuestaoRodadaRetorna()
        {
            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = conectionDB.ObjetoConexao;
                conectionDB.Conectar();
                cmd.CommandText = "SELECT * FROM Quiz_Tecnologia WHERE ID_PERGUNTA  = @ID";
                cmd.Parameters.AddWithValue("@ID", Convert.ToString(recebeValor));
                mdr = cmd.ExecuteReader();

                if (mdr.Read())
                {
                    rodadaQuestao = Convert.ToInt32((mdr["ID_PERGUNTA"].ToString()));
                }
            }
            catch (SqlException)
            {
                throw;
            }
            finally
            {
                conectionDB.Desconectar();
            }
            return(rodadaQuestao);
        }
 public void Cadastrar(C_CadatrarDados dados)
 {
     try
     {
         conectionDB.Conectar();
         cmd.Connection  = conectionDB.ObjetoConexao;
         cmd.CommandText = "INSERT INTO TB_DADOSJOGADOR (ID_JOGADOR, JOGADOR, SENHA) VALUES (NEWID(),@NOME,@SENHA)";
         cmd.Parameters.AddWithValue("@NOME", dados.Nome);
         cmd.Parameters.AddWithValue("@SENHA", dados.Senha);
         cmd.ExecuteNonQuery();
     }
     catch (SqlException erroIN)
     {
         throw new ApplicationException(erroIN.Message);
     }
     finally
     {
         conectionDB.Desconectar();
     }
 }
Example #4
0
        public string metodoPegaID()
        {
            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = ConectionDB.ObjetoConexao;
                ConectionDB.Conectar();
                cmd.CommandText = "SELECT * FROM TB_DadosPlayer WHERE JOGADOR  = @JOGADOR";
                cmd.Parameters.AddWithValue("@JOGADOR", nomeJogadors);
                mdr = cmd.ExecuteReader();

                if (mdr.Read())
                {
                    armazenaID = (mdr["GUIDJOGADOR"].ToString());
                }
            }
            catch (SqlException erro)
            {
                throw new ApplicationException(erro.Message);
            }
            finally
            {
                ConectionDB.Desconectar();
            }
            return(armazenaID);
        }