Пример #1
0
        /* The next 6 methods are to get the ID's of a template that the user selected,
         * and then deletes the rows associatied with the ID's from bottom to top
         * (options -> section -> template)*/

        //Gets the templateID of the template that the user wants removed
        public void getRemoveTemplateID(string sqlQuery, string Rname)
        {
            //Create SQL Command object.
            SqlCommand     command = new SqlCommand();
            removeTemplate getID   = new removeTemplate();

            command.CommandType = CommandType.Text;
            command.CommandText = sqlQuery;

            //adds the template name to the parameters.
            command.Parameters.AddWithValue("@templateRemoveName", Rname);

            //Opens Connection to the Database.
            openConnection();
            command.Connection = connectionToDB;

            //executes the sql statement. The sql statement will find the TempId based on the name association
            int ID = Convert.ToInt32(command.ExecuteScalar());

            //calls the method to pass the ID variable to the tempID from the removeTemplate
            getID.turn_to_Remove_ID(ID);

            //Closes the Database Connection.
            closeConnection();
        }