mssrivathsan
New member
- Joined
- Dec 21, 2011
- Messages
- 1
- Programming Experience
- Beginner
hey there guys. I have coded my own mysql login program. But I have got a problem with it. I have added the following codes in my program
The problem with it is that, even if I enter a correct username and password it shows the "Invalid User" message. I have checked the username and password a thousand times. Please help me out in this problem..
VB.NET:
Dim MySqlConnection As MySqlConnection MySqlConnection = New MySqlConnection()
MySqlConnection.ConnectionString = "server=***; user id=***; password=3z4tmyd; database=***;"
Try
MySqlConnection.Open()
Catch myerror As MySqlException
MsgBox(myerror.Message)
End Try
Try
Dim myadapter As New MySqlDataAdapter
Dim sqlquary = "SELECT * FROM register WHERE username = '" & Usernametextbox.Text & "' AND password = '" & Passwordtextbox.Text & "';"
Dim command As New MySqlCommand
command.Connection = MySqlConnection
command.CommandText = sqlquary
myadapter.SelectCommand = command
Dim mydata As MySqlDataReader
mydata = command.ExecuteReader()
If mydata.HasRows = 0 Then
MsgBox("Invalid user")
Else
MsgBox("Welcome user")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
The problem with it is that, even if I enter a correct username and password it shows the "Invalid User" message. I have checked the username and password a thousand times. Please help me out in this problem..