Why is reader null?
It shouldn’t be. It may have .HasRows == false, but there should be an object.
Why do you think it ever is null?
OK, new title with a clue.
You have to drop the @
in the SQL text as it denotes @UserID as a parameter and not as a column. And I’m also doubtful about the SELECT part. Try:
"SELECT UserID FROM Users WHERE UserID= '" + UsersIDentity + "'"
6
solved Problem writing a simple SELECT query [closed]