Private Sub RetrieveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RetrieveButton.Click
conn = New MySqlConnection
conn.ConnectionString = "server=127.0.0.1; Port=3306; user id=root; password=; database=bsit3d"
Dim READER As MySqlDataReader
Dim Command As New MySqlCommand
conn.Open()
Dim Query As String
Query = "select * from bsit3d.form where username= '" & username.Text & "' "
Command = New MySqlCommand(Query, conn)
READER = Command.ExecuteReader
Dim arrImage() As Byte
While READER.Read
StudentID.Text = READER.GetString("studentID")
Lastname.Text = READER.GetString("lastname")
Firstname.Text = READER.GetString("firstname")
Middlename.Text = READER.GetString("middlename")
Birthdate.Text = READER.GetString("birthday")
Age.Text = READER.GetString("age")
Address.Text = READER.GetString("address")
ComboBox1.Text = READER.GetString("gender")
Emailadd.Text = READER.GetString("emailadd")
Religion.Text = READER.GetString("religion")
password.Text = READER.GetString("password")
READER.Read()
arrImage = READER.Item("image")
Dim mstream As New System.IO.MemoryStream(arrImage)
PictureBox2.Image = Image.FromStream(mstream)
READER.Close()
End While
MessageBox.Show("Student's information is shown.")
conn.Close()
conn.Dispose()
End Sub