I'm trying to use an AJAX function to see if a username already exists in a MySQL database, the function works in VS2005 if I use the debug utility to change the value of 'count' to 1, here is the code:
Private Function UserNameExists(ByVal userName As String) As Boolean
Dim con As New MySqlConnection(ConnectionStrings("testConn").ConnectionString)
Dim cmd As New MySqlCommand("Select Count(*) From dk_users Where username = @username", con)
Dim result As Boolean = False
Dim count As Integer = CType(cmd.ExecuteScalar(), Integer)
If count > 0 Then
result = True
But as it stands count is always 0, I've run the SQL through MySQL Query Browser and appended a username to it's parameters manually and count is returning 1, so I don't know why the count is not correct in the function.
Please let me know if you need any more of the code?