异常详细信息: System.InvalidOperationException: 阅读器关闭时 FieldCount 的尝试无效。
阅读器关闭时 FieldCount 的尝试无效。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.InvalidOperationException: 阅读器关闭时 FieldCount 的尝试无效。
源错误:
行 44: dlHTDJ.DataValueField = "htdjid ";
行 45: dlHTDJ.DataSource = htlbReader;
行 46: dlHTDJ.DataBind();
行 47:
行 48: CloseConnection();
源文件: h:\ASP.NET\WebSites\WebSite2\hetong\contractedit.aspx.cs 行: 46
====================================================================================
源码是这样的,在页面的page_load里面,有
if (!IsPostBack) {
HTDJSql = "select htlbid,htlb from htlb order by htlbid ";
OleDbDataReader htlbReader = GetDataReader(HTDJSql);
dlHTLB.DataTextField = "htlb ";
dlHTLB.DataValueField = "htlbid ";
dlHTLB.DataSource = htlbReader;
dlHTLB.DataBind();
CloseConnection();
//然后检索
HTDJSql = "select htdjid,htdj from htdj order by htdjid ";
OleDbDataReader htdjReader = GetDataReader(HTDJSql);
dlHTDJ.DataTextField = "htdj ";
dlHTDJ.DataValueField = "htdjid ";
dlHTDJ.DataSource = htlbReader;
dlHTDJ.DataBind();
CloseConnection();
subDisplay();
}