Echec de validation: 53-Le fichier 'c:\windows\system32\inetsrv\IMG_4035734409363.jpeg' est introuvable.
Bonjour tout le monde.
Je tente d'insérer une image dans une base de données SqlServer avec du code behind en asp.net.
Voilà le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Private Sub ValiderImage(ByVal CheminImage As String)
If CheminImage = "" Then Exit Sub
SqlConn.Open()
Dim myCommand As New SqlCommand
myCommand.Connection = SqlConn
myCommand.CommandText = "update zz_societe set Logo=@BLOBData where (Code=@Idx)"
myCommand.Parameters.Add(New SqlParameter("@Idx", ancien_code.Value))
'Dim strBLOBFilePath As String = CheminImage
Dim fsBLOBFile As New FileStream(CheminImage, FileMode.Open, FileAccess.Read)
Dim bytBLOBData(fsBLOBFile.Length() - 1) As Byte
fsBLOBFile.Read(bytBLOBData, 0, bytBLOBData.Length)
fsBLOBFile.Close()
myCommand.Parameters.Add(New SqlParameter("@BLOBData", SqlDbType.VarBinary, bytBLOBData.Length, ParameterDirection.Input, False, 0, 0, Nothing, DataRowVersion.Current, bytBLOBData))
myCommand.ExecuteNonQuery()
SqlConn.Close()
myCommand = Nothing
bytBLOBData = Nothing
fsBLOBFile = Nothing
End Sub |
Ce code marche proprement quand je développe en vb.net simplement. Mais ici, il marche quand je suis en mode développement. Mais quand je déploie l'application sur un serveur IIS, il m'affiche l'erreur suivante
Citation:
Echec de validation: 53-Le fichier 'c:\windows\system32\inetsrv\IMG_4035734409363.jpeg' est introuvable.
Si quelqu'un a une idée, je suis preneur.
Merci d'avance