郁闷,一句简单SQL引发了内存溢出,求指导。 string sqlText = "SELECT T.* FROM fats T "; OracleCommand cmd = new OracleCommand(sqlText); pageDt=new DbUtility().Query(cmd);
DbUtility是一个数据库帮助类,和大部分的没什么区别 问题是该页面执行别的的语句没问题
public partial class ShipMovingSearch : BasePage { protected DataTable pageDt; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitPage(); } }
private void InitPage() { string SqlForDropType = "select * from fbtype t"; OracleCommand cmd = new OracleCommand(SqlForDropType); this.DropShipType.DataSource = new DbUtility().Query(cmd); this.DropShipType.DataTextField = "TYPE_NAME"; this.DropShipType.DataValueField = "TYPE_ID"; this.DropShipType.DataBind(); //BtnSearch_Click(this.BtnSearch, new EventArgs()); }
protected void BtnSearch_Click(object sender, EventArgs e) { string sqlText = "SELECT T.* FROM fats T "; OracleCommand cmd = new OracleCommand(sqlText); pageDt=new DbUtility().Query(cmd); } }
init里面的sql执行就没问题 一到按钮按下就出问题 我别的页面结构几乎一样 没问题
我估计是SQL的问题
------解决方案--------------------
------解决方案--------------------
select top 20 * from fats where sid not in (select top 40 sid from fats order by sid )
------解决方案-------------------- 升级到sql2012 分页 容易
------解决方案-------------------- 分页还是用存储过程好些