Transport properties of bulk and thin-film MgB2 superconductors: effects of preparation conditions