系统堆栈溢出异常
请帮助我解决 System.StackOverflowException 我正在设计一个 .aspx 将记录写入数据库,我使用 4 层架构来实现这一点,一切正常,但是当我编译页面时,它会显示要插入数据的字段,当我将数据插入到这些字段并单击时提交按钮然后显示 System.StackOverflowException 发生
public class Customers
{
public Customers()
{
int CustomerID = 0;
string Fname = string.Empty;
string Lname = string.Empty;
string Country = string.Empty;
}
public int CustomerID
{
get { return CustomerID; }
set { CustomerID = value; }
}
public string Fname
{
get { return Fname; }
set { Fname = value; }****
}
public string Lname
{
get { return Lname; }
set { Lname = value; }
}
public string Country
{
get { return Country; }
set { Country = value; }
}
当页面执行时弹出并显示一个窗口 System.StackOverflowException 发生请给我解决此问题的任何人
please help me regarding System.StackOverflowException
i m desing a .aspx to write records into the database i used 4-tier archietecture to implement this everything are working but when im compiling the page then its displyae the fields to insert the data ,when i insert the data to those field and clik the submitt button then its showes System.StackOverflowException occured
public class Customers
{
public Customers()
{
int CustomerID = 0;
string Fname = string.Empty;
string Lname = string.Empty;
string Country = string.Empty;
}
public int CustomerID
{
get { return CustomerID; }
set { CustomerID = value; }
}
public string Fname
{
get { return Fname; }
set { Fname = value; }****
}
public string Lname
{
get { return Lname; }
set { Lname = value; }
}
public string Country
{
get { return Country; }
set { Country = value; }
}
When page is executing a window is popuped and displayed System.StackOverflowException occured please give me anyone solution to this problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您正在递归地将值分配给自身。其他属性也是如此。
您需要使用其他名称定义备份字段,例如:
或者更好:
You are assigning the value to itself recursively. And the same for the other properties.
You need to define a backup field with another name, for example:
Or even better:
请尝试以下操作:
Try the following:
您的属性 Get & 中有无限递归调用设置如下:
Lname = value;将再次致电您的物业&再次。
there is infinite recusrive calls in your properties Get & Set like:
Lname = value; will call your property again & again.