I am having a problem that dtAsia.rows.count>0 doesn't count at all. All I want to do is tell the user that their username already exists in the game but I'm having a bad time now because for example: I entered a valid username and its success... I entered an invalid username and got the CATCH part of this code.. So if i entered a valid username again. I still got the CATCH part of the code until the end even if I enter valid or invalid username still got the CATCH part. What did I do wrong here? I will really appreciate answers. Thank you
If (dtAsia.Rows.Count > 0) Then ' wont work
MsgBox("Username: " & Trim(txtUsername.Text) & " is already exist.", MsgBoxStyle.OkOnly, "Message :")
Else
Try
Call open_conn()
SqlComm.Connection = conn
SqlComm.CommandText = "Select * from Personal_Information"
SqlComm.CommandText = "INSERT INTO Personal_Information(Username) values('" & Trim(txtUsername.Text) & "')
SqlComm.ExecuteNonQuery()
Call close_conn()
MessageBox.Show("Account registered successfully!", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call Updater()
Catch ex As Exception 'Here is the CATCH PART
MsgBox("error " & Trim(txtUsername.Text) & " is already exist.", MsgBoxStyle.OkOnly, "Message :")
End Try
End If