Police say Miguel Valvidia was a former student at the school.
The superintendent of schools says Valvidia came into the school as students were arriving.
A shelter in place was put into effect for a couple of hours.
He's charged with trespassing and is being held on a $100,000 bond.