andi_g69 is correct about the spaces, but I wanted to add in that you will also get an error if uid is null.

When in doubt in situations like this, have your program or ASP page output the query for you and see if it looks right. Try copying the resulting query into Query Analyzer or whatever db you're using and execute it there. You may get a better error that way.