Esempio n. 1
0
        public static void DeleteQuestionWithAnswersFromDb(long questionId)
        {
            var tableAdapter = new QuestionTableAdapter();
            tableAdapter.DeleteQuestionWithAnswers(questionId);

            /*Old version with stored procedure, may be removed if tableAdapter works as it should.
            using (var connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                var cmd =
                    new SqlCommand("DeleteQuestionWithAnswers",
                        connection) {CommandType = CommandType.StoredProcedure};
                cmd.Parameters.Add("@questionid", SqlDbType.BigInt).Value = questionId;
                cmd.Prepare();
                cmd.ExecuteNonQuery();
            }*/
        }