Once corn on the cob has been picked it will usually only last a day or 2 out of the refrigerator but if you refrigerate the freshly picked corn on the cob it should last as long as 3 to 4 days.
If you want to keep corn on the cob longer than 3 to 4 days then you can freeze the corn on the cob and the frozen corn on the cob will last from 10 months to a year.
Frozen food keeps much longer than refrigerated food since the freezing temperatures on the food keep bacteria from growing.