最近做的一个数据库管理系统 由于数据量过大 现在出现了System.OutOfMemoryException的问题请问如何处理
源代码:if (Session["Power"].ToString() == "管理员")
{
Response.Write("<script> alert('您没有去重权限')</script>");
}
else
{
int rows = 0;
BLL.CustomInfor bll = new BLL.CustomInfor();
DataSet ds1 = bll.SelectForDelete("业主");
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
DataSet ds2 = bll.SelectByID("业主", Convert.ToInt32(ds1.Tables[0].Rows[i]["C_id"].ToString()));
for (int j = 0; j < ds2.Tables[0].Rows.Count; j++)
{
if (ds1.Tables[0].Rows[i]["C_Phone"].ToString() == ds2.Tables[0].Rows[j]["C_Phone"].ToString())
{
rows = rows + bll.DeleteCus(Convert.ToInt32(ds2.Tables[0].Rows[j]["C_id"].ToString()));
}
}
}
Response.Write("<script> alert('共删除了" + rows + "条数据')</script>");
}
Bind();
源代码:if (Session["Power"].ToString() == "管理员")
{
Response.Write("<script> alert('您没有去重权限')</script>");
}
else
{
int rows = 0;
BLL.CustomInfor bll = new BLL.CustomInfor();
DataSet ds1 = bll.SelectForDelete("业主");
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
DataSet ds2 = bll.SelectByID("业主", Convert.ToInt32(ds1.Tables[0].Rows[i]["C_id"].ToString()));
for (int j = 0; j < ds2.Tables[0].Rows.Count; j++)
{
if (ds1.Tables[0].Rows[i]["C_Phone"].ToString() == ds2.Tables[0].Rows[j]["C_Phone"].ToString())
{
rows = rows + bll.DeleteCus(Convert.ToInt32(ds2.Tables[0].Rows[j]["C_id"].ToString()));
}
}
}
Response.Write("<script> alert('共删除了" + rows + "条数据')</script>");
}
Bind();
解决方案 »
- js 给textbox直接enter触发button事件
- c# 如何用PictureBox 获取相机的实时界面?
- C# 中怎么样提取配置文件中特定的值?高手帮忙,最好贴下代码!谢谢!
- 如何判断域中是否有"nattystyle"用户存在
- 数组控件
- 用for循环实例化线程并执行,但实际却执行了部分线程,高人相助!~
- 如果关闭整个工程?
- c# 如何通过程序增加词条到已建立的语法中?
- ado.net更适合存取本地数据吗(相比ado来说)?
- 请各位帮忙比较一下哪种方法更好?谢谢了!
- 在我本机测试数据输出正常,其它电脑访问就出现字体是倒的
- sap.net3.0调用录屏的RFC函数返回的信息,谁能帮我看看错误原因是什么。
我博客有xx版本這裡
每次查询只查一页不就行了吗 为什么要都放进去呢 如果你硬要都放进去 估计你那代码再怎么调整也没用因为它是要占用大量内存的 再者说加载的时间也不是一般人能接受的 System.OutOfMemoryException 已经提示你内存溢出了嘛