1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
If cn.State = ConnectionState.Open Then
cn.Close()
cn.Open()
Else
cn.Open()
End If
com.Connection = cn
com.CommandText = "Update [personne] set image= @img where id_personne=" & Me.txt_id.Text & "'"
im = PictureBox1.BackgroundImage
Dim ms As New System.IO.MemoryStream
Dim arrPicture() As Byte
im.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
arrPicture = ms.GetBuffer()
Dim parr As New OleDbParameter
parr = New OleDbParameter("@img", OleDbType.VarBinary, ParameterDirection.Input)
parr.Value = arrPicture
com.Parameters.Add(parr)
com.ExecuteNonQuery() |
Partager