Don't bother getting him to write code unless you allow time for it and let him use online resources... its what we all do.
Instead get him to write a solution to a problem in pseudo code... this is more important IMHO as it shows someone is able to think a problem through. The way that they plan through the solution (even if it is usually in your head) is more important that knowing the exact syntax of for loops and sql statements.
Alternative to the above, is just give him a problem, and ask him to verbally say how he would go about writing the solution. You'll soon know if they know much about programming (so long as you do...)