bonjour
je veux insérer une requête dans une base de données sqlserver
strSql = "insert into dbo.entreprise values('" & TextBox1.Text & "','" & PictureBoxImageToBytes(PictureBox1) & "' ,'" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "')"
avec
1 2 3 4 5 6 7 8 9 10 11 12 13
| Public Function PictureBoxImageToBytes(ByVal picBox As PictureBox) As Byte()
If (picBox IsNot Nothing) AndAlso (picBox.Image IsNot Nothing) Then
Dim bmp As New Bitmap(picBox.Image)
Dim ms As New System.IO.MemoryStream()
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp)
Dim buff As Byte() = ms.ToArray()
ms.Close()
ms.Dispose()
Return buff
Else
Return Nothing
End If
End Function |
mais j 'ai une erreur au niveau de 2eme champs
l'opérateur & n'est pas défini pour les type 'string' 'tableau à 1 dimension de byte'
Partager