protected void Poll1_Voted(object sender, PollItemEventArgs e)
    {
        OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PollConnectionString"].ConnectionString);

        conn.Open();
       
        string logVoteQuery = "INSERT INTO UserVotes(AnswerID, UserID) VALUES(@AnswerID, @UserID)";
        OleDbCommand logVoteCommand = new OleDbCommand(logVoteQuery, conn);
        logVoteCommand.Parameters.AddWithValue("@AnswerID", e.Item.Value);
        logVoteCommand.Parameters.AddWithValue("@UserID", UserID.ToString());

        logVoteCommand.ExecuteNonQuery();
          
        conn.Close();
    }
Exemple #2
0
    protected void Poll1_Voted(object sender, PollItemEventArgs e)
    {
        OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PollConnectionString"].ConnectionString);

        conn.Open();

        string       logVoteQuery   = "INSERT INTO UserVotes(AnswerID, UserID) VALUES(@AnswerID, @UserID)";
        OleDbCommand logVoteCommand = new OleDbCommand(logVoteQuery, conn);

        logVoteCommand.Parameters.AddWithValue("@AnswerID", e.Item.Value);
        logVoteCommand.Parameters.AddWithValue("@UserID", UserID.ToString());

        logVoteCommand.ExecuteNonQuery();

        conn.Close();
    }
Exemple #3
0
    protected void Poll1_Voting(object sender, PollItemEventArgs e)
    {
        OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PollConnectionString"].ConnectionString);

        conn.Open();

        foreach (PollAnswer answer in Poll1.Answers)
        {
            if (answer.Selected)
            {
                string       logVoteQuery   = "UPDATE Answers SET Votes = Votes + 1 WHERE AnswerID = @AnswerID";
                OleDbCommand logVoteCommand = new OleDbCommand(logVoteQuery, conn);
                logVoteCommand.Parameters.AddWithValue("@AnswerID", answer.Item.Value);

                logVoteCommand.ExecuteNonQuery();

                break;
            }
        }

        conn.Close();
    }
    protected void Poll1_Voting(object sender, PollItemEventArgs e)
    {
        OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PollConnectionString"].ConnectionString);

        conn.Open();

        foreach (PollAnswer answer in Poll1.Answers)
        {
            if (answer.Selected)
            {
                string logVoteQuery = "UPDATE Answers SET Votes = Votes + 1 WHERE AnswerID = @AnswerID";
                OleDbCommand logVoteCommand = new OleDbCommand(logVoteQuery, conn);
                logVoteCommand.Parameters.AddWithValue("@AnswerID", answer.Item.Value);

                logVoteCommand.ExecuteNonQuery();

                break;
            }
        }

        conn.Close();
    }