Hi!
I am building a form where I want to insert an image, or the data source of the image, into an Access database.
With this code I am able to display an image in a PictureBox.
Code:
Dim OpenFileDialog1 As New OpenFileDialog
With OpenFileDialog1
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
picArt.Image = Image.FromFile(.FileName)
End If
End With
But now I want to send it and save it in my database when I click a button, and I can't figure out how.
I am using this code to open my database connection;
Code:
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim icount As Integer
Dim str As String
cn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=H:\programs\Project\Database.mdb;")
cn.Open()
str = "INSERT INTO Table1 (Picture) VALUES (???)"
cmd = New OleDb.OleDbCommand(str, cn)
icount = cmd.ExecuteNonQuery
MessageBox.Show("Saved")
cn.Close()
The ??? in my string means I don't know what to write here.
Help would be most appreciated.