English 中文(简体)
一种无操作的类型系统例外。
原标题:An unhandled exception of type System.StackOverflowException occurred in mscorlib.dll
  • 时间:2011-07-11 02:50:31
  •  标签:
  • .net
  • asp.net

我在协会中撰写了一部法典。 NET读到SQ表的数据,并在Grid View中展示,并使用Row Data Bound活动。 但是,在我管理该方案时,这一例外产生于“一种不相干的类型系统例外”。

    private void BindAllUsers()
    {
        SqlDataAdapter da = new SqlDataAdapter("SELECT ID, Name, Email, Password, Contact, CreatedOn, CreatedBy,CreatedIP From tbl_Users",con);
        DataSet ds = new DataSet();
        da.Fill(ds);       <------(Error occurs in this line)
        gdv_Users.DataSource = ds;
        gdv_Users.DataBind();

    }

罗达塔·博迪 活动管理员是:

    protected void gdv_Users_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        e.Row.Cells[0].Style["Cursor"] = "hand";
        e.Row.Cells[0].ToolTip = "Click Here";
        e.Row.Cells[0].Attributes.Add("onclick","window.open( Details.aspx ?ID=" + e.Row.Cells[0].Text.ToString()+" Details ; width = 735,height= 350,left = 220,top = 300,resizable = 0,scrollbars = 0,status = no )");
    }

The BindAllUser Function is listed here:

 protected void Page_Load(object sender, EventArgs e)
{
    BindAllUsers();
    BindDropDown();

}
最佳回答

为此:

        private void BindAllUsers()
    {
        using (SqlConnection con = new SqlConnection("connection string"))
        {
            con.Open();
            SqlCommand command = new SqlCommand();
            command.Connection = con;
            command.CommandText = "SELECT ID, Name, Email, Password, Contact, CreatedOn, CreatedBy,CreatedIP From tbl_Users";
            SqlDataReader dr = command.ExecuteReader();
            if (dr.HasRows)
            {
                gdv_Users.DataSource = ds;
                gdv_Users.DataBind();
            }
        }

    }
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签