You have not specified what your problem is, but looking at the code supplied you seem to using the wrong parameter name in the
AddWithValue
call.
You specify the query as:
SELECT TypeID FROM Registration where usename = @UserName
but use
'@TypeID'
in the call to the
AddWithValue
function.
You need to change
cmd.Parameters.AddWithValue("@TypeID", usename)
into
cmd.Parameters.AddWithValue("@UserName", usename)