There are so many myths about buying corn. It needs to be cooked as soon as its picked or it won't be sweet. White corn is better than yellow, or vice versa. Relax, it's not that complicated.
In the first place, most of the corn you'll buy today will be pretty sweet even if it was harvested a couple of days ago. Thanks to some ingenious plant breeders, new varieties of corn don't convert sugar to starch with nearly the speed they used to.
Of course, lovers of old-timey corn now claim that these new types lack the creamy texture and "corny" flavor of the cobs of their childhoods, and there is truth to both of those complaints.
You win some, you lose some. I'd say overall we've come out ahead.
When it comes to which color of corn is sweeter, the answer is: both. Today, whether you prefer white or yellow corn has more to do with what you learned where you were brought up (and which old varieties were prevalent there), than any actual flavor difference.
As far as I'm concerned, the best way to cook fresh corn is grilled on the cob. It's probably not coincidental that this is also the easiest. Here's what you do: Soak corn in its husk in water for a half-hour; put it on the grill, turning every 5 minutes or so to cook evenly; it'll be done when the husks have dried and started to blacken and the color of the kernels have intensified, about 25 minutes.
Shuck the corn after cooking. You'll notice the silk comes away with the husk without a problem.
You can thank me later.
How to choose: Look for silky tassels that are still moist and not dried out. Feel through the husk and the kernels should be swollen and distinct. Peel back just the tip of the husk and make sure the tips are filled out (you don't need to shuck the whole ear – that makes farmers cranky, and justifiably so).
How to store: Refrigerate corn, tightly wrapped, still in its husks. Try to keep it away from other strong-scented foods because it will absorb odors quite readily.