Imports MySql.Data.MySqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As MySqlConnection
'connect to DB
conn = New MySqlConnection()
conn.ConnectionString = "Server=localhost;User Id=root;Password=;Database=grapescorp"
'see if cennection failed
Try
conn.Open()
Catch myerror As MySqlException
MsgBox("ERROR CONNECTIng to database")
End Try
'
Dim myAdapter As New MySqlDataAdapter
Dim sqlquery = "SELECT * FROM data WHERE id='" + TextBox1.Text + "' AND name='" + TextBox2.Text + "'"
Dim myCommand As New MySqlCommand()
myCommand.Connection = conn
myCommand.CommandText = sqlquery
'start query
myAdapter.SelectCommand = myCommand
Dim myData As MySqlDataReader
myData = myCommand.ExecuteReader()
'see if user exist
If myData.HasRows = 0 Then
MsgBox("Invalid Login")
Else
MsgBox("Login Accepted")
Form2.Show()
Me.Hide()
End If
Me.Close()
End Sub
End Class
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :