On treating ethanolic solution of nitroalkane with silver nitrite (Ag−O−N=OAg−O−N=O), nitroalkane is formed because since the bond between Ag−OAg−Ois covalent, the lone pair on nitrogen acts as an attacking site for nucleophilic substitution.
R−X+AgNO2⟶R−NO2+AgXR−X+AgNOX2⟶R−NOX2+AgXBut on the other hand if haloalkane is treated with potassium nitrite (KNO2KNOX2), alkyl nitrite is formed as major product because since the bond between K−OK−Ois ionic in nature, the negative charge on oxygen serves as an attacking site.
R−X+KNO2⟶R−O−N=O+KX