The reason it was stupid was this: he didn't actually have a plan. This occurred to him about a second after he'd run into the room, and so as the club bore down on him he just pointed his wand in the general direction of the troll and said the first thing that came to mind, the Vanishing spell he'd started learning in McGonagall's class just a few weeks before. "Evanesco!" he said desperately, and to his surprise (and the troll's confusion) the club vanished.