Hi,
I started writing a basic project that logs you in via data stored on a MySQL Database, and returns with a new form. I'm using the MySQL connector, and I can't seem get around this error :\
Here's the Code:
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
MySqlConnection = New MySqlConnection
MySqlConnection.ConnectionString = "server=db4free.net;Port=3306; user id=xxx; password=xxx; database=xxx"
MySqlConnection.Open()
Dim MyAdapter As New MySqlDataAdapter
Dim sqlquary = "SELECT * From users 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("ERROR: Wrong Login Information, Try again!", MsgBoxStyle.Critical, "ERROR")
Else
Form1.Show()
Me.Hide()
End If
I started writing a basic project that logs you in via data stored on a MySQL Database, and returns with a new form. I'm using the MySQL connector, and I can't seem get around this error :\
Here's the Code:
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
MySqlConnection = New MySqlConnection
MySqlConnection.ConnectionString = "server=db4free.net;Port=3306; user id=xxx; password=xxx; database=xxx"
MySqlConnection.Open()
Dim MyAdapter As New MySqlDataAdapter
Dim sqlquary = "SELECT * From users 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("ERROR: Wrong Login Information, Try again!", MsgBoxStyle.Critical, "ERROR")
Else
Form1.Show()
Me.Hide()
End If