Bonjour,

J'essaie de faire la mise à jour de mon gridview, quand je clique sur le bouton "edit" il m'affiche le message erreur suivant. Je ne le comprends pas.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
Exception Details: System.ArgumentException: Column 'P_CODE' does not belong to table DefaultView

Je suis bloqué par ça depuis bientôt une semaine, mon chef commence à s'énerver et je le comprends...HELP, AU SECOURS veuillez m'aidez je vous en prie...MERCI

Voici le bout de code:

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
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="EncodageMedecins.aspx.cs" Inherits="EncodageMedecins" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server"> 
 
    <h1>
    </h1>    
    <div>   
    <h1>
        Espace médecins  
    </h1>
    </div>    
    <div>
        <asp:Label ID="LblCodeInami" runat="server" Text="Code Inami"></asp:Label> 
        <asp:TextBox ID="TxtBxCdeInami" runat="server" width= 250px>
        </asp:TextBox>
    </div>    
    <div> 
        <asp:Label ID="LblNomMédecin" runat="server" Text="Nom du Médecin"></asp:Label>
        <asp:TextBox ID="TxtBxNomMédecin" runat="server" OnTextChanged="TxtBxNomMédecin_TextChanged">
        </asp:TextBox>
    </div>
    <div>
        <asp:Label ID="Label3" runat="server" Text="      "></asp:Label> 
        <asp:Button ID="BtnRecherche" runat="server" Text="Patients" OnClick="BtnRecherche_Click"  />
        <asp:Button ID="BtnAnnuler" runat="server" Text="Annuler" />
        &nbsp;</div>     
    <div>
    <div>
        <asp:Label ID="LabelMedecin" runat="server" Text=""></asp:Label>
 
    </div>
 
    <asp:SqlDataSource 
         ID="SqlDataSourceMedecins" 
         runat="server"           
         ProviderName="<%$ ConnectionStrings:OracleConnectionString.ProviderName %>"
         SelectCommand='SELECT "PD_PATIENT", P_CODE, "P_NAME","P_FNAME","CONSENT" as "Accord", "D_LNAME","D_FNAME"   FROM "MEDIWEB_MED_EXT" WHERE ("INAMI" = :INAMI)'        
         UpdateCommand='Update "MEDIWEB_MED_EXT" SET P_CODE=:P_CODE,"P_NAME"=:P_NAME,"P_FNAME"=:P_FNAME,"D_LNAME"=:D_LNAME,"D_FNAME"=:D_FNAME,"CONSENT"=:CONSENT where ("PD_PATIENT"=:PD_PATIENT)'
         ConnectionString ="<%$ ConnectionStrings:OracleConnectionString %>">                                
 
        <SelectParameters>
            <asp:ControlParameter ControlID="TxtBxCdeInami" Name="INAMI" PropertyName="Text"
                Type="String" />              
        </SelectParameters>    
 
 
 
    </asp:SqlDataSource >  &nbsp;</div>  
    <div>    
        <asp:GridView ID="GridViewMedecins" runat="server" 
        AllowPaging="True" 
        AllowSorting="True" 
        DataSourceID="SqlDataSourceMedecins" 
        CellPadding="4" 
        ForeColor="#333333" 
        GridLines="None" 
        OnPageIndexChanging="GridViewMedecins_PageIndexChanging" 
        AutoGenerateColumns="False" 
        OnDataBound="GridViewMedecins_DataBound" 
        OnRowDataBound="GridViewMedecins_RowDataBound" 
        DataKeyNames ="PD_PATIENT"        
        AutoGenerateEditButton="True">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>                
                <asp:BoundField DataField="P_CODE" HeaderText="P_CODE" SortExpression="P_CODE" />
                <asp:BoundField DataField="P_NAME" HeaderText="P_NAME" SortExpression="P_NAME" />
                <asp:BoundField DataField="P_FNAME" HeaderText="P_FNAME" SortExpression="P_FNAME" />
                <asp:BoundField DataField="Accord" HeaderText="Accord" SortExpression="Accord" />                
                <asp:BoundField DataField="D_LNAME" HeaderText="D_LNAME" SortExpression="D_LNAME" > 
                <ItemStyle CssClass="colonneInvisible" />
                 <HeaderStyle CssClass ="colonneInvisible" />                 
                </asp:Boundfield>
 
                <asp:BoundField DataField="D_FNAME" HeaderText="D_FNAME" SortExpression="D_FNAME" >
                 <ItemStyle CssClass = "colonneInvisible" />
                  <HeaderStyle CssClass ="colonneInvisible"  />
                </asp:BoundField>
                <asp:HyperLinkField DataNavigateUrlFields="P_CODE" DataNavigateUrlFormatString="DetailsPatient.aspx?ID={0}"
                    Text="Détails..." />
 
 
            </Columns>
 
        </asp:GridView>
 
    </div>
 
</asp:Content>