当前位置:编程学习 > C#/ASP.NET >>

ASP.NET的问题DataBinding:“System.Data.DataRowView”不包含名为“E_mail”的属性

在aspx页面中
<asp:Label ID="pwdLabel" runat="server" Text='<%# Bind("pwd") %>'></asp:Label><br />
 E_mail:
 <asp:Label ID="E_mailLabel" runat="server" Text='<%# Bind("E_mail") %>'></asp:Label><br />
添加时间:
 <asp:Label ID="addedtimeLabel" runat="server" Text='<%# Bind("addedtime") %>'></asp:Label><br />
上面报错!!
这是aspx页面的全部代码!!
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=PC2009051900QCU;Initial Catalog=news;Integrated Security=True"
            ProviderName="System.Data.SqlClient"
             DeleteCommand="DELETE FROM [user] WHERE [userID] = @userID AND [username] = @username AND [pwd] = @pwd AND [E_mail] = @E_mail AND [addedtime] = @addedtime"
            InsertCommand="INSERT INTO [user] ( [username], [pwd], [E_mail], [addedtime]) VALUES (@username, @pwd, @E_mail, @addedtime)"
            OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [user]"
            UpdateCommand="UPDATE [user] SET [username] = @username, [pwd] = @pwd, [E_mail] = @E_mail,  [addedtime] = @addedtime  WHERE  [userID] = @userID  AND  [username] = @username  AND  [pwd] = @pwd  AND  [E_mail] = @E_mail  AND  [addedtime] = @addedtime">
            <DeleteParameters>
                <asp:Parameter Name="original_userID" Type="Int32" />
                <asp:Parameter Name="original_username" Type="String" />
                <asp:Parameter Name="original_pwd" Type="String" />
                <asp:Parameter Name="original_E_mail" Type="String" />
                <asp:Parameter Name="original_addedtime" Type="DateTime" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="username" Type="String" />
                <asp:Parameter Name="pwd" Type="String" />
                <asp:Parameter Name="E_mail" Type="String" />
                <asp:Parameter Name="addedtime" Type="DateTime" />
                <asp:Parameter Name="original_userID" Type="Int32" />
                <asp:Parameter Name="original_username" Type="String" />
                <asp:Parameter Name="original_pwd" Type="String" />
                <asp:Parameter Name="original_E_mail" Type="String" />
                <asp:Parameter Name="original_addedtime" Type="DateTime" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="userID" Type="Int32" />
                <asp:Parameter Name="username" Type="String" />
                <asp:Parameter Name="pwd" Type="String" />
                <asp:Parameter Name="E_mail" Type="String" />
                <asp:Parameter Name="addedtime" Type="DateTime" />
            </InsertParameters>
        
       </asp:SqlDataSource>
    
    </div>
        <asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataKeyNames="userID"
            DataSourceID="SqlDataSource1">
            <EditItemTemplate>
                用户编号:
                <asp:Label ID="userIDLabel1" runat="server" Text='<%# Eval("userID") %>'></asp:Label><br />
                用户名:
                <asp:TextBox ID="usernameTextBox" runat="server" Text='<%# Bind("username") %>'></asp:TextBox><br />
                密码:
                <asp:TextBox ID="pwdTextBox" runat="server" Text='<%# Bind("pwd") %>'></asp:TextBox><br />
                E_mail:
                <asp:TextBox ID="E_mailTextBox" runat="server" Text='<%# Bind("E_mail") %>'></asp:TextBox><br />
                添加时间:
                <asp:TextBox ID="addedtimeTextBox" runat="server" Text='<%# Bind("addedtime") %>'></asp:TextBox><br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                    Text="更新"></asp:LinkButton>
                <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="取消"></asp:LinkButton>
            </EditItemTemplate>
            <InsertItemTemplate>
                用户名:
                <asp:TextBox ID="usernameTextBox" runat="server" Text='<%# Bind("username") %>'></asp:TextBox><br />
                密码:
                <asp:TextBox ID="pwdTextBox" runat="server" Text='<%# Bind("pwd") %>'></asp:TextBox><br />
                E_mail:
                <asp:TextBox ID="E_mailTextBox" runat="server" Text='<%# Bind("E_mail") %>'></asp:TextBox><br />
                添加时间:
                <asp:TextBox ID="addedtimeTextBox" runat="server" Text='<%# Bind("addedtime") %>'></asp:TextBox><br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                    Text="插入"></asp:LinkButton>
                <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="取消"></asp:LinkButton>
            </InsertItemTemplate>
            <ItemTemplate>
                用户编号:
                <asp:Label ID="userIDLabel" runat="server" Text='<%# Eval("userID") %>'></asp:Label><br />
                用户名:
                <asp:Label ID="usernameLabel" runat="server" Text='<%# Bind("username") %>'></asp:Label><br />
                密码:
                <asp:Label ID="pwdLabel" runat="server" Text='<%# Bind("pwd") %>'></asp:Label><br />
                E_mail:
                <asp:Label ID="E_mailLabel" runat="server" Text='<%# Bind("E_mail") %>'></asp:Label><br />
                添加时间:
                <asp:Label ID="addedtimeLabel" runat="server" Text='<%# Bind("addedtime") %>'></asp:Label><br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                    Text="编辑"></asp:LinkButton>
                <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                    Text="删除"></asp:LinkButton>
                <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
                    Text="新建"></asp:LinkButton>
            </ItemTemplate>
            <HeaderTemplate> --------------------编程问答-------------------- 数据源中看看有没有E_mail --------------------编程问答-------------------- 数据库中有 --------------------编程问答--------------------
你确定user表有E_mail字段的话,就把这句写成完整的形式看看
 SelectCommand="SELECT * FROM [user]";
就是把要查询的字段也写出来


--------------------编程问答-------------------- 但是这是一个可以执行增加,编辑,删除的的语句啊,不会死一个完整的查询语句啊
--------------------编程问答-------------------- 这是对数据的一个编辑,删除,增加的SQL语句,不是要查询全部的东西
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,