.HasRows Problem

davek604

New member
Joined
Aug 7, 2007
Messages
1
Programming Experience
1-3
Hello
I'd really appreciate any help with this as its been driving me mad for about a week now. The code below checks a MySQL database to see if a user is present and if not it opens a form to add the user to the database. The problem is that the form opens for half a second and closes but if you change If Output.HasRows = False to If Output.HasRows = True it works fine but then the form is opening when the name is already in the database and therefore no good.

Cheers

Dave

OutputCommand.Connection = conn
OutputCommand.CommandText = "SELECT UserName FROM Coilusers WHERE UserName = ?TheName "
OutputCommand.Parameters.AddWithValue("TheName", Login(2))
UsersName = Login(2)
conn.Open()
Output = OutputCommand.ExecuteReader
If (Output.HasRows = False) Then
NoUser.UserAddBox.Text = UsersName
NoUser.ShowDialog()
End If
conn.Close()
 
Back
Top