D
D
VisualStyleElement
Imports MySql.Data.MySqlClient
Imports System.IO
End Sub
End Sub
' Set the file filter to specify the types of files you want to allow.
openFileDialog.Filter = "All Files|*.*|Text Files|*.txt|PDF Files|*.pdf"
' Process the selected file, for example, display the file path in a
TextBox.
SaveDocumentToDatabase(selectedFilePath)
End If
End Sub
' Function to save the selected document to the database
Private Sub SaveDocumentToDatabase(filePath As String)
' Read the document content into a byte array
Dim documentContent As Byte() = File.ReadAllBytes(filePath)
Try
Using connection As MySqlConnection = New
MySqlConnection(connectionString)
connection.Open()
End Class