'Open Files Dialog Multiselect = true
If OpenImageFile.ShowDialog = Windows.Forms.DialogResult.OK AndAlso OpenImageFile.FileName <> Nothing Then
' ลูปไฟล์ที่เลือก stream เป็นไบต์ INSERT ลง MySQL
For Each file As String In OpenImageFile.FileNames
Try
Dim pic As New PictureBox
pic.Image = Image.FromFile(file)
Using stream As New IO.MemoryStream
pic.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg)
strSQL = "INSERT INTO picture(byte_pic,key_pic,note_pic)" _
& "VALUES(@byte_pic,@key_pic,@note_pic)"
cmd = New MySqlCommand(strSQL, ConnectionDB)
cmd.Parameters.AddWithValue("@byte_pic", stream.GetBuffer())
cmd.Parameters.AddWithValue("@key_pic", "images1")
cmd.Parameters.AddWithValue("@note_pic", "note")
Call open_connection()
cmd.ExecuteNonQuery()
stream.Close()
End Using
Catch ex As Exception
End Try
Next
End If