This should be done once in initialization code, not repeatedly every time the page is shown.
For a single insert you do not need to use a transaction. Either the insert succeeds or it fails (in which case you'll get an exception) - no need for a transaction.
if (citycode == "" || citycode == null)
if (usernames == userName)
(multiple occurrences) You shouldtest for null first, and then perform other tests. Also, strings are compared using the "equals" method, not using "==" (which compares equality of object references, not equality of objects). So this code should read