把登录注册实例原样传服务器上,管理员登陆和会员登录,出现下列代码,请问都是什么问题?书上出错还是其他原因?如何改正?
管理员登陆错误
Server Error in '/' Application.
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'UserID'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'UserID'.
Source Error:
Line 32: <td style="width: 90px">
Line 33: <asp:Button ID="btnEdit" runat="server" CommandName="edit" Text="编辑" />
Line 34: <asp:Button ID="btnDelete" runat="server" CommandName="delete" Text="删除" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"UserID") %>' OnLoad="btnDelete_Load" /></td>
Line 35: <td style="width: 86px">
Line 36: <asp:Button ID="btnSetRole" runat="server" CommandName="setRole" Text='<%# (bool) DataBinder.Eval(Container.DataItem,"Role")==true?"取消管理员权限":"设为管理员权限" %>' CommandArgument = '<%# DataBinder.Eval(Container.DataItem,"UserID") %>'/></td>
Source File: d:\freehost\zszq888\web\UserManagement.aspx Line: 34
会员登陆错误
Server Error in '/' Application.
Object cannot be cast from DBNull to other types.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Object cannot be cast from DBNull to other types.
Source Error:
Line 18: if (!IsPostBack)
Line 19: {
Line 20: if (Convert.ToBoolean (Session["Role"]))
Line 21: selVal = "";
Line 22: else
Source File: d:\freehost\zszq888\web\UserManagement.aspx.cs Line: 20