System.Web.dll中出现“System.OutOfMemoryException”类型的异常,但未在用户代码中处理 [英] An exception of type 'System.OutOfMemoryException' occurred in System.Web.dll but was not handled in user code

查看:122
本文介绍了System.Web.dll中出现“System.OutOfMemoryException”类型的异常,但未在用户代码中处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用数据库表加载页面时动态添加表。但它不起作用。它给了我一个例外:

System.Web.dll中出现类型''System.OutOfMemoryException'的例外但未在用户代码中处理



我的代码:

I want to add a Table dynamically when the page is load with database table. But it''s not working. Its give me a Exception:
An exception of type ''System.OutOfMemoryException'' occurred in System.Web.dll but was not handled in user code

My Code:

if (!IsPostBack == true)
            {
                System.Web.UI.WebControls.Login LoginControl = (System.Web.UI.WebControls.Login)PreviousPage.FindControl("Login1");
                if (LoginControl != null)
                {
                    TextBox UserName = (TextBox)LoginControl.FindControl("UserName");
                    if (UserName != null)
                    {
                        superEmail = UserName.Text.ToString();
                        //db.command.Parameters.Add("@SupervisorEmail", SqlDbType.VarChar).Value = superEmail.ToString();
                        //grdView.DataSource = db.Adapter("spVerify", true);
                        //grdView.DataBind();
                        lbl1.Text = superEmail.ToString();
                        db.command.Parameters.Add("@SupervisorEmail", SqlDbType.VarChar).Value = superEmail.ToString();
                        db.Adapter("spVerify", "okay", true);
                        for (int i = 0; i < db.dataSet.Tables["okay"].Rows.Count; i++)
                        {
                            TableRow tr = new TableRow();
                            for (int j = 0; j < 5; i++)
                            {
                                TableCell tc = new TableCell();
                                if(j == 0)
                                {
                                    tc.Text = db.dataSet.Tables["okay"].Rows[0][j].ToString();
                                    tr.Cells.Add(tc);
                                }
                                if (j == 1)
                                {
                                    tc.Text = db.dataSet.Tables["okay"].Rows[0][j].ToString();
                                    tr.Cells.Add(tc);
                                }
                                if (j == 2)
                                {
                                    tc.Text = db.dataSet.Tables["okay"].Rows[0][j].ToString();
                                    tr.Cells.Add(tc);
                                }
                                if (j == 3)
                                {
                                    LinkButton link = new LinkButton();
                                    link.ID = "l" + i.ToString();
                                    link.Text = db.dataSet.Tables["okay"].Rows[0][4].ToString();
                                    link.EnableViewState = true;
                                    link.CommandName = db.dataSet.Tables["okay"].Rows[0][j].ToString();
                                    link.Command += new CommandEventHandler(link_Command);
                                    //tc.Text = db.dataSet.Tables["okay"].Rows[0][j].ToString();
                                    tc.Controls.Add(link);
                                    tr.Cells.Add(tc);
                                }
                                if (j == 4)
                                {
                                    tc.Text = db.dataSet.Tables["okay"].Rows[0][j].ToString();
                                    tr.Cells.Add(tc);
                                }
                            }
                            tbl.Rows.Add(tr);
                        }
                    }
                }
                else
                {
                    //Label1.Text = "Cannot find user name in Login control.";
                }
            }





请帮帮我。



Please help me.

推荐答案

服务器上没有足够的RAM处理你的操作。使操作减少内存消耗或向服务器添加更多内存将解决问题。
There is not enough RAM on the server to handle your operation. Make the operation less memory consuming or add more memory to the server will solve the problem.


这篇关于System.Web.dll中出现“System.OutOfMemoryException”类型的异常,但未在用户代码中处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆