Difference between valency and oxidation state
Valency is a term used to describe the number of bonds a given atom undergoes in a certain environment. For example, the carbon atom in all of the following substances is tetravalent:


methane
methanol
difluoromethane
formic acid
carbon dioxide


An example for a formally trivalent carbon would be carbon monoxide. Note how valency only counts how many bonds and how many lone pairs an atom has.

The oxidation state is used as a formal measurement on how formally negative an atom should be under standard conditions. For this, each bond is split heterogenously and both electrons are counted as belonging to the electronegative partner only. Then, the electrons on each atom are counted, the difference to a neutral atom of the same kind is established which constitutes the oxidation number. The compound above — while all being tetravalent — have different oxidation numbers:


methane $\mathrm{-IV}$
methanol $\mathrm{-II}$
difluoromethane $\mathrm{\pm 0}$
formic acid $\mathrm{+II}$
carbon dioxide $\mathrm{+IV}$