我使用 sp_cursoropen 来实现分页操作。在da.Fill(Result);(Result是个DataSet类型。)有时会出现如下错误。但数据库服务重启就解决问题.特别是数据服务运行几个小时后,这个问题就一直出现.
sp_cursoropen详细在http://community.csdn.net/Expert/topic/4816/4816642.xml?temp=.2518274
堆栈跟踪:
[SqlException: 未能完成游标操作,因为在声明游标后,表架构有更改。]
System.Data.SqlClient.SqlDataReader.Read()
System.Data.Common.DbDataAdapter.FillLoadDataRow(SchemaMapping mapping)
System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
BoDa.UseerControls.Pager1.GetResult() in D:\Inetpub\wwwroot\tongcheng\UseerControls\Pager1.ascx.cs:161
BoDa.UseerControls.Pager1.DataBind(PagerEventArgs ce) in D:\Inetpub\wwwroot\tongcheng\UseerControls\Pager1.ascx.cs:130
BoDa.UseerControls.Pager1.DataBind() in D:\Inetpub\wwwroot\tongcheng\UseerControls\Pager1.ascx.cs:121
tongcheng.BatMan.advice.advice.rtadviceBind(String sql) in D:\Inetpub\wwwroot\tongcheng\BatMan\advice\advice.aspx.cs:99
tongcheng.BatMan.advice.advice.Page_Load(Object sender, EventArgs e) in D:\Inetpub\wwwroot\tongcheng\BatMan\advice\advice.aspx.cs:64
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
这到底是什么问题,为什么有时出现有时不会.特别是sql语句使用嵌套子查询时,出现频率更高.
sp_cursoropen详细在http://community.csdn.net/Expert/topic/4816/4816642.xml?temp=.2518274
堆栈跟踪:
[SqlException: 未能完成游标操作,因为在声明游标后,表架构有更改。]
System.Data.SqlClient.SqlDataReader.Read()
System.Data.Common.DbDataAdapter.FillLoadDataRow(SchemaMapping mapping)
System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
BoDa.UseerControls.Pager1.GetResult() in D:\Inetpub\wwwroot\tongcheng\UseerControls\Pager1.ascx.cs:161
BoDa.UseerControls.Pager1.DataBind(PagerEventArgs ce) in D:\Inetpub\wwwroot\tongcheng\UseerControls\Pager1.ascx.cs:130
BoDa.UseerControls.Pager1.DataBind() in D:\Inetpub\wwwroot\tongcheng\UseerControls\Pager1.ascx.cs:121
tongcheng.BatMan.advice.advice.rtadviceBind(String sql) in D:\Inetpub\wwwroot\tongcheng\BatMan\advice\advice.aspx.cs:99
tongcheng.BatMan.advice.advice.Page_Load(Object sender, EventArgs e) in D:\Inetpub\wwwroot\tongcheng\BatMan\advice\advice.aspx.cs:64
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
这到底是什么问题,为什么有时出现有时不会.特别是sql语句使用嵌套子查询时,出现频率更高.
解决方案 »
- 线程的使用--执行 CreateHandle() 时无法调用值 Dispose()。
- 中括号问题public user[] selectall()
- vs2005能不能单独为窗体生成一个dll文件
- ACCESS怎么和c#.net连接数据库?
- 关于多线程的问题
- cannot start debugging .unable to find Microsoft Internet Explorer.
- [急!] c#如何直接操作ppt的图表数据,winfrom下mschart图表如何倒入到excel或ppt中
- 该如何写这个类??
- 请问有没有方法判断对象未实例化?
- WebClient类下载文件进度的问题
- 集合类如何定义这样的接口?
- 动态创建控件的问题?
CSDN小助手是一款脱离浏览器也可以访问Csdn论坛的软件
界面:http://blog.csdn.net/Qqwwee_Com/archive/2005/11/05/523395.aspx
下载:http://szlawbook.com/csdnv2