Afficher image dans état sous MS ACCESS

relena Messages postés 1 Date d'inscription samedi 29 janvier 2005 Statut Membre Dernière intervention 13 octobre 2009 - 13 oct. 2009 à 15:54
Marroubi Messages postés 51 Date d'inscription lundi 18 mai 2009 Statut Membre Dernière intervention 30 octobre 2009 - 20 oct. 2009 à 11:47
Bonjour,
J'ai fait une base de donnée sous MS ACCESS avec en objet OLE une image pour chaque ligne. Seulement dans l'état pour l'impression mon image n'apparait pas c'est un carré blanc que puis-je faire ?
Merci d'avance. Cordialement.

1 réponse

Marroubi Messages postés 51 Date d'inscription lundi 18 mai 2009 Statut Membre Dernière intervention 30 octobre 2009 2
20 oct. 2009 à 11:47
Salut;
je sais pas ce que votre code est bien traité ou pas; en tout cas je vous donne un exemple d'insertion d'une ligne dans un tableau access qui contient un champ de type objet ole ou une image. ce morceau de code est en VB.NET :

Public Shared Function Inserer(ByVal nom As String, ByVal informations As String, ByVal image As [Byte]())

Try
SupHerbesBibliotheque.Connexion.Open()
Dim querString As String
If image Is Nothing Then
querString = "INSERT INTO Plantes([Nom], [Information], [Image]) VALUES (?, ?, '')"
Else
querString = "INSERT INTO Plantes([Nom], [Information], [Image]) VALUES (?, ?, ?)"
End If
Dim command As New OleDb.OleDbCommand(querString, SupHerbesBibliotheque.Connexion.Connexion)
Dim parNom As New OleDb.OleDbParameter
parNom.ParameterName = "Nom"
parNom.OleDbType = OleDb.OleDbType.VarWChar
parNom.Direction = ParameterDirection.Input
parNom.Value = nom
command.Parameters.Add(parNom)
Dim parInfos As New OleDb.OleDbParameter
parInfos.ParameterName = "Information"
parInfos.OleDbType = OleDb.OleDbType.VarWChar
parInfos.Direction = ParameterDirection.Input
parInfos.Value = informations
command.Parameters.Add(parInfos)
If Not image Is Nothing Then
Dim parImage As New OleDb.OleDbParameter
parImage.ParameterName = "Image"
parImage.OleDbType = OleDb.OleDbType.VarBinary
parImage.Direction = ParameterDirection.Input
parImage.Value = image
command.Parameters.Add(parImage)
End If
command.ExecuteNonQuery()
Return True
Catch ex As Exception
Return False
End Try

End Function
0
Rejoignez-nous