Option Explicit On
Imports MySql.Data.MySqlClient
Public Class LOGIN
Dim conn As MySqlConnection
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
'Setting of Variables...
Dim mycommand As MySqlCommand
conn = New MySqlConnection
'Connection string...
conn.ConnectionString="server=localhost;
database=GeneticDatabase;user=root;password=root;"
mycommand = New MySqlCommand
mycommand.Connection = conn
'Finding the record...
mycommand.CommandText = "SELECT Username,Password FROM Login " & "WHERE Username = '" & txtUsername.Text & "'
Password = '" & txtPassword.Text & "'"
End Sub
My problem is this how to put a condition using if Else Statement next to select statement. When the user type his/her username on txtUsername and password in the txtPassword and when it matches the records in the table Login it generates messagebox Record Found and if not it generates a message Record Not found...
Thanks in advance...
Imports MySql.Data.MySqlClient
Public Class LOGIN
Dim conn As MySqlConnection
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
'Setting of Variables...
Dim mycommand As MySqlCommand
conn = New MySqlConnection
'Connection string...
conn.ConnectionString="server=localhost;
database=GeneticDatabase;user=root;password=root;"
mycommand = New MySqlCommand
mycommand.Connection = conn
'Finding the record...
mycommand.CommandText = "SELECT Username,Password FROM Login " & "WHERE Username = '" & txtUsername.Text & "'
Password = '" & txtPassword.Text & "'"
End Sub
My problem is this how to put a condition using if Else Statement next to select statement. When the user type his/her username on txtUsername and password in the txtPassword and when it matches the records in the table Login it generates messagebox Record Found and if not it generates a message Record Not found...
Thanks in advance...