Imports MySql.Data.MySqlClient
Module Module1
Public con As New MySqlConnection
Public cmd As New MySqlCommand
Sub openCon()
con.ConnectionString = "server=localhost;username=root;password=;database=mydatabase"
con.Open()
End Sub
End Module
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = “” Or TextBox2.Text = “” Or TextBox3.Text = “” Or TextBox4.Text = “” Or TextBox5.Text = “” Then
MsgBox(“Please fill up all the boxes”)
ElseIf TextBox2.Text <> TextBox3.Text Then
MsgBox("Password doesn't match. Please check your input.")
Else
openCon()
Try
cmd.Connection = con
cmd.CommandText = "INSERT INTO register (`USERNAME`,`PASSWORD`,`EMAIL`) VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox4.Text & "')"
cmd.ExecuteNonQuery()
MsgBox("Registered successfully!")
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
Form3.Show()
Me.Hide()
con.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End If
End Sub
All I know is to insert value to phpmyadmin but not retrieving it back to visual basic.