Bonjour,
je souhaite récupérer un fichier photo pour l'insérer dans une table.
Voici mon code:
Voici le message d'erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104 <InsertItemTemplate> <td runat="server" style=""> <table> <tr> <td> Civilité : </td> <td> <asp:DropDownList ID="LstCivilites" runat="server" DataSourceID="DstCivilites" DataTextField="LibelleLong" DataValueField="Identifiant"> </asp:DropDownList> <asp:EntityDataSource ID="DstCivilites" runat="server" ConnectionString="name=CS_LearningCompany" DefaultContainerName="LearningCompanyEntities" EnableFlattening="False" EntitySetName="Civilite"> </asp:EntityDataSource> </td> </tr> <tr> <td> Nom : </td> <td> <asp:TextBox ID="NomTextBox" runat="server" Text='<%# Bind("Nom") %>' /> <asp:RequiredFieldValidator ID="RqvNomTextBox" runat="server" ValidationGroup="InsertItem" ControlToValidate="NomTextBox" ErrorMessage="Veuillez saisir un nom." Text="*"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> Prénom : </td> <td> <asp:TextBox ID="PrenomTextBox" runat="server" Text='<%# Bind("Prenom") %>' /> <asp:RequiredFieldValidator ID="RqvPrenomTextBox" runat="server" ValidationGroup="InsertItem" ControlToValidate="PrenomTextBox" ErrorMessage="Veuillez saisir un prénom." Text="*"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> Photo : </td> <td> <asp:FileUpload ID="UplPhoto" runat="server" Width="200px" /> <asp:RequiredFieldValidator ID="RqvNomFichierPhotoTextBox" runat="server" ValidationGroup="InsertItem" ControlToValidate="UplPhoto" ErrorMessage="Veuillez sélectionner une photo." Text="*"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> Email : </td> <td> <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' /> <asp:RequiredFieldValidator ID="RqvEmailTextBox" runat="server" ValidationGroup="InsertItem" ControlToValidate="EmailTextBox" ErrorMessage="Veuillez saisir un email." Text="*"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> Téléphone : </td> <td> <asp:TextBox ID="TelephoneTextBox" runat="server" Text='<%# Bind("Telephone") %>' /> <asp:RequiredFieldValidator ID="RqvTelephoneTextBox" runat="server" ValidationGroup="InsertItem" ControlToValidate="TelephoneTextBox" ErrorMessage="Veuillez saisir un téléphone." Text="*"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> Prestataire : </td> <td> <asp:CheckBox ID="IntervenantExterieurCheckBox" runat="server" Checked='<%# Bind("IntervenantExterieur") %>' /> </td> </tr> <tr> <td> Informations : </td> <td> <asp:TextBox ID="InfosTextBox" runat="server" TextMode="MultiLine" Rows="3" Text='<%# Bind("Infos") %>' /> <asp:RequiredFieldValidator ID="RqvInfosTextBox" runat="server" ValidationGroup="InsertItem" ControlToValidate="InfosTextBox" ErrorMessage="Veuillez saisir un résumé de compétences." Text="*"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> </td> </tr> <tr> <td style="text-align: right;"> <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Valider" ValidationGroup="InsertItem" /> </td> <td style="text-align: right;"> <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Annuler" /> </td> </tr> </table> </td> </InsertItemTemplate>
Je n'ai pas trop d'idées pour résoudre le problème!Impossible d'insérer la valeur NULL dans la colonne 'NomFichierPhoto', table 'LearningCompany.dbo.Formateur'. Cette colonne n'accepte pas les valeurs NULL. Échec de INSERT.
L'instruction a été arrêtée.
Merci d'avance de votre réponse.
Mumu27!
Partager