cyborg8274:
im using a 12v supply to arduino jack and this is how im connecting the solenoid and im using 5v pin from arduino to power the solenoid too
Can't do that. You will fry the 5volt regulator.
The 5volt regulator on an Uno can't deliver more than 100mA (0.1Amp) when the Uno is powered with 12volt.
Leo..