First off, bad way of getting data from database. Totally open for security threat via SQL Injection.
Read about protecting from SQL Injection here: SQL Injection Mitigation: Using Parameterized Queries
believe 'User Name' s the coumn name with space in your database. If so, put that in square brackets:
String checkuser = "select count(*) from UserData where [User Name]=' " + TextBoxUN.Text + "'";
Currently, User name is not considered one word by SQL and throws back an error.