My problem is with the checking of the username and password against a mysql database, I'm not sure how I would go about doing it. I have searched google but haven't been able to find anything I can understand. Don't give me the answer, just help me out. I am trying to learn.
Imports System.Data.SqlClient
Imports System.Data.Sql
Public Class LoginForm1
Private Sub OK_Click() Handles OK.Click
Dim Selection() As String = {"SELECT * FROM `users` WHERE `username` = `" + TxtUsername.Text.ToString() + "` AND `password` = `" + TxtPassword.Text.ToString() + "`;"}
MySql("server=;Port=; user id: password: database=", Selection)
If ???.HasRows = 0 Then
MsgBox("Bad Login")
Else
Form1.Show()
Application.ExitThread()
End If
End Sub
Private Sub Cancel_Click() Handles Cancel.Click
Me.Close()
End Sub
Private Sub LoginForm1_Load() Handles MyBase.Load
End Sub
Private Sub LogoPictureBox_Click() Handles LogoPictureBox.Click
End Sub
Private Sub MySql(ByVal ConnectionString As String, ByVal query_array() As String)
Try
Using MySqlConnection As New SqlConnection(ConnectionString.ToString())
For i = 0 To query_array.Length Step 1
Dim MySqlCommand As New SqlCommand(query_array(i), MySqlConnection)
MySqlCommand.Connection.Open()
MySqlCommand.ExecuteNonQuery()
Next
End Using
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class