I couldn't find anything on the internet, but this should work:
Step 1
Open your game and select "Mystery Gift" from the Title Screen.
Step 2
Open the record book of all the mystery Gifts you have recieved.
Step 3
Select the Mystery Gift card of Diancie.
Step 4
Delete the card.
Theoretically, once you delete the Diance card, the game has no proof that you already gave a code, therefore you can put in a new one. If this answer is considered incomplete or doesn't have enough proof, I can hide it or convert it to a comment.