A search for the standard model Higgs boson (H) decaying to \bbbar when produced in association with a weak vector boson (V) is reported for the following modes: \mathrm{W}(\mu\nu)\mathrm{H},~ \mathrm{W}(e\nu)\mathrm{H},~ \mathrm{Z}(\mu\mu)\mathrm{H},~ \mathrm{Z}(ee)\mathrm{H} and . The search is performed in a data sample corresponding to an integrated luminosity of ~fb, recorded by the CMS detector in proton-proton collisions at the LHC with a center-of-mass energy of 7\TeV during 2011, and in a data sample of up to ~fb of 8\TeV collisions during 2012. No significant excess of events above the background expectation is observed. Upper limits on the VH production cross section times the \PH\to \bbbar branching ratio, with respect to the expectations for a standard model Higgs boson, are derived for a Higgs boson in the mass range 110--135\GeV. In this range, the observed 95\% confidence level upper limits vary from 1.4 to 4.2 times the standard model prediction; the corresponding expected limits vary from 1.2 to 2.8.