Can't. I've tried. It corrupts the first save on the game.
By "first save" I mean that Pokémon D/P made a system that takes two saves. If you enter the union room and trade a pokémon, the game makes a temporary save that you're unaware of. If you turn off the game during one of these trades.. when you turn it back on it will give you a blue screen saying the save file is corrupt and that it is reverting to an earlier save point.
The illegal way to use an Action Replay, but that also possesses a chance to corrupt your data.