locked
An unhandled exception of type 'System.StackOverflowException', how to handle this problem?

    Question

  • class CreateCage (simple code, not complete)

    //

       this.cButton.Location = new System.Drawing.Point(88, 168);
       this.cButton.Name = "cButton";
       this.cButton.Size = new System.Drawing.Size(88, 23);
       this.cButton.TabIndex = 3;
       this.cButton.Text = "Create Cage";
       cButton.Click += new System.EventHandler(cButton_click);

       fmhandler = new Form1();

    private void cButton_click(Object sender, System.EventArgs e)
      {
       string temp = fmhandler.getCstring();
       MessageBox.Show(temp);
       fmhandler.infotextBox.Text= temp;
       this.Hide();
      }

      public int getNumber()
      {
       try
       {
        number = Convert.ToInt32(inputtextBox.Text);
        return number;
       }
       catch(FormatException)
       {
        MessageBox.Show("pls input integer");
        return -1;
       }

    //

    Form1 main method in here

    //

    this.cageItem.Index = 0;
       this.cageItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                          this.cItem,
                          this.dItem,
                          this.menuItem5,
                          this.qItem});
       this.cageItem.Text = "&Cage";
       //
       // cItem
       //
       createdialog = new CreateCage();
       createdialog.Hide();
       this.cItem.Index = 0;
       this.cItem.Text = "Create";
       this.cItem.Click+= new EventHandler(cItem_click);
    public string getCstring()
      {
       int food =0;
        
       int i=0;
       int number = createdialog.getNumber();
         
       IEnumerator nu = list.GetEnumerator();
       while (nu.MoveNext())
       {
          
        if(((Cage)nu.Current).CageNumber==number)
        {
         i++;
        }

       }

       if (i==0)
       {
        cage = new Cage(food,number);
        list.Add(cage);
        a="Cage "+ number +"  is created";
        return a;
       }
       else
       {
        a= "the cage exsist";
        return a;
       }

      }
      

      public void cItem_click(Object sender, System.EventArgs e)
      {
                createdialog.Show();
        
      }

    static void Main()
      {
       Application.Run(new Form1());
      }

    //

    this is part of SimZooGUI project , all of relative logic is in here, compile sucessfully, when run, error happened in the line I marked red.

    ERROR: An unhandled exception of type 'System.StackOverflowException' occurred in SimZooGUI.exe

    why? How to handle it?

    Thanks a lot!!!!!!

     

     

    Wednesday, March 15, 2006 9:39 PM

Answers

  • I do not see any place in the code where it recursively calls itself.  Is this the line that is continually being called?  If you look at the stack trace of the exception then the method that is being repeated called is the method that triggered the stack overflow.  Search for all cases where this method is invoked and ensure that it doesn't call itself.  Note that you can also get into such a situation if you do something in an event handler that will cause the event to be raised again.  For example in your click handler if you do something to cause the button to be clicked again then you'll recurse.

    Michael Taylor - 3/16/06

    Thursday, March 16, 2006 2:27 PM

All replies

  • I do not see any place in the code where it recursively calls itself.  Is this the line that is continually being called?  If you look at the stack trace of the exception then the method that is being repeated called is the method that triggered the stack overflow.  Search for all cases where this method is invoked and ensure that it doesn't call itself.  Note that you can also get into such a situation if you do something in an event handler that will cause the event to be raised again.  For example in your click handler if you do something to cause the button to be clicked again then you'll recurse.

    Michael Taylor - 3/16/06

    Thursday, March 16, 2006 2:27 PM
  • I understand whats happening it is recalling more then it should when it compiles but how do i get the system to stop doing that my code isnt wrong when i build but when i go to debug my system it keeps giving me that error system.StackOverflow exception it should only be called one time in the compilation process how do i set my system to know that this event method is to be called once and twice or how ever many times it calling it
    Wednesday, August 30, 2006 10:58 PM
  • it has nothing to do with the compiler/system - in your code somewhere you are accidently perhaps calling the same function - over and over, a function which is calling itself. As TaylorMichael had suggested, and quite rightly so, somewhere in your code it is calling itself, causing it to cause the exception

    it may not neccesarily be that code but some way there abouts - usually it is spot on at pointing to the correct code causing the problem but there are some exceptions to this - are you able to step through into the debugger when you click the button or during the event process at which this occurs? stepping through would help to find out where the problem would be

    Wednesday, August 30, 2006 11:09 PM
  • ok, I understand now what you mean but I dont have recursive code ill show in my example of code:

    // btnCreditEnter

    //

    this.btnCreditEnter.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCreditEnter.Location = new System.Drawing.Point(168, 304);

    this.btnCreditEnter.Name = "btnCreditEnter";

    this.btnCreditEnter.Size = new System.Drawing.Size(56, 48);

    this.btnCreditEnter.TabIndex = 11;

    this.btnCreditEnter.Text = "Enter";

    this.btnCreditEnter.Click += new System.EventHandler(this.btnCreditEnter_Click);

    //

    // label2

    //

    this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

    this.label2.Location = new System.Drawing.Point(40, 8);

    this.label2.Name = "label2";

    this.label2.Size = new System.Drawing.Size(192, 40);

    this.label2.TabIndex = 13;

    this.label2.Text = "Welcome to Credit Buddy Please Enter Credit PIN #";

    this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;

    //

    // txtSecureInfo

    //

    this.txtSecureInfo.BackColor = System.Drawing.SystemColors.HighlightText;

    this.txtSecureInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

    this.txtSecureInfo.Location = new System.Drawing.Point(56, 56);

    this.txtSecureInfo.Name = "txtSecureInfo";

    this.txtSecureInfo.PasswordChar = '*';

    this.txtSecureInfo.ReadOnly = true;

    this.txtSecureInfo.Size = new System.Drawing.Size(160, 26);

    this.txtSecureInfo.TabIndex = 14;

    this.txtSecureInfo.Text = "";

    //

    // btnCancel

    //

    this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

    this.btnCancel.Location = new System.Drawing.Point(56, 352);

    this.btnCancel.Name = "btnCancel";

    this.btnCancel.Size = new System.Drawing.Size(168, 32);

    this.btnCancel.TabIndex = 15;

    this.btnCancel.Text = "Cancel";

    this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);

    //

    // lblActiveID

    //

    this.lblActiveID.Location = new System.Drawing.Point(56, 80);

    this.lblActiveID.Name = "lblActiveID";

    this.lblActiveID.Size = new System.Drawing.Size(160, 16);

    this.lblActiveID.TabIndex = 16;

    this.lblActiveID.Text = "PayPal@SecurityTransaction";

    //

    // objTransaction

    //

    this.objTransaction.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=;Data Source=""G:\C#Projects\TouchScreenProgram\bin\Transactions\TransactionManagment.mdb"";Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False";

    //

    // objUpdatePin

    //

    this.objUpdatePin.CommandText = "UPDATE CustomerTransactions SET PinNumber = ? WHERE (ActiveID = ?)";

    this.objUpdatePin.Connection = this.objTransaction;

    this.objUpdatePin.Parameters.Add(new System.Data.OleDb.OleDbParameter("PinNumber", System.Data.OleDb.OleDbType.VarWChar, 16, "PinNumber"));

    this.objUpdatePin.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_ActiveID", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ActiveID", System.Data.DataRowVersion.Original, null));

    //

    // btnCredit

    //

    this.btnCredit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit.Location = new System.Drawing.Point(56, 128);

    this.btnCredit.Name = "btnCredit";

    this.btnCredit.Size = new System.Drawing.Size(88, 32);

    this.btnCredit.TabIndex = 17;

    this.btnCredit.Text = "Credit";

    this.btnCredit.Click += new System.EventHandler(this.btnCredit_Click);

    //

    // btnDebit

    //

    this.btnDebit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnDebit.Location = new System.Drawing.Point(144, 128);

    this.btnDebit.Name = "btnDebit";

    this.btnDebit.Size = new System.Drawing.Size(80, 32);

    this.btnDebit.TabIndex = 18;

    this.btnDebit.Text = "Debit";

    this.btnDebit.Click += new System.EventHandler(this.btnDebit_Click);

    //

    // lblChargeType

    //

    this.lblChargeType.Location = new System.Drawing.Point(56, 104);

    this.lblChargeType.Name = "lblChargeType";

    this.lblChargeType.Size = new System.Drawing.Size(104, 16);

    this.lblChargeType.TabIndex = 19;

    //

    // btnCredit1

    //

    this.btnCredit1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit1.Location = new System.Drawing.Point(56, 160);

    this.btnCredit1.Name = "btnCredit1";

    this.btnCredit1.Size = new System.Drawing.Size(56, 48);

    this.btnCredit1.TabIndex = 20;

    this.btnCredit1.Text = "1";

    this.btnCredit1.Click += new System.EventHandler(this.btnCredit1_Click);

    //

    // btnCredit2

    //

    this.btnCredit2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit2.Location = new System.Drawing.Point(112, 160);

    this.btnCredit2.Name = "btnCredit2";

    this.btnCredit2.Size = new System.Drawing.Size(56, 48);

    this.btnCredit2.TabIndex = 21;

    this.btnCredit2.Text = "2";

    this.btnCredit2.Click += new System.EventHandler(this.btnCredit2_Click);

    //

    // btnCredit3

    //

    this.btnCredit3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit3.Location = new System.Drawing.Point(168, 160);

    this.btnCredit3.Name = "btnCredit3";

    this.btnCredit3.Size = new System.Drawing.Size(56, 48);

    this.btnCredit3.TabIndex = 22;

    this.btnCredit3.Text = "3";

    this.btnCredit3.Click += new System.EventHandler(this.btnCredit3_Click);

    //

    // btnCredit4

    //

    this.btnCredit4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit4.Location = new System.Drawing.Point(56, 208);

    this.btnCredit4.Name = "btnCredit4";

    this.btnCredit4.Size = new System.Drawing.Size(56, 48);

    this.btnCredit4.TabIndex = 23;

    this.btnCredit4.Text = "4";

    this.btnCredit4.Click += new System.EventHandler(this.btnCredit4_Click);

    //

    // btnCredit5

    //

    this.btnCredit5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit5.Location = new System.Drawing.Point(112, 208);

    this.btnCredit5.Name = "btnCredit5";

    this.btnCredit5.Size = new System.Drawing.Size(56, 48);

    this.btnCredit5.TabIndex = 24;

    this.btnCredit5.Text = "5";

    this.btnCredit5.Click += new System.EventHandler(this.btnCredit5_Click);

    //

    // btnCredit6

    //

    this.btnCredit6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit6.Location = new System.Drawing.Point(168, 208);

    this.btnCredit6.Name = "btnCredit6";

    this.btnCredit6.Size = new System.Drawing.Size(56, 48);

    this.btnCredit6.TabIndex = 25;

    this.btnCredit6.Text = "6";

    this.btnCredit6.Click += new System.EventHandler(this.btnCredit6_Click);

    //

    // btnCredit7

    //

    this.btnCredit7.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit7.Location = new System.Drawing.Point(56, 256);

    this.btnCredit7.Name = "btnCredit7";

    this.btnCredit7.Size = new System.Drawing.Size(56, 48);

    this.btnCredit7.TabIndex = 26;

    this.btnCredit7.Text = "7";

    this.btnCredit7.Click += new System.EventHandler(this.btnCredit7_Click);

    //

    // btnCredit8

    //

    this.btnCredit8.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit8.Location = new System.Drawing.Point(112, 256);

    this.btnCredit8.Name = "btnCredit8";

    this.btnCredit8.Size = new System.Drawing.Size(56, 48);

    this.btnCredit8.TabIndex = 27;

    this.btnCredit8.Text = "8";

    this.btnCredit8.Click += new System.EventHandler(this.btnCredit8_Click);

    //

    // btnCredit9

    //

    this.btnCredit9.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit9.Location = new System.Drawing.Point(168, 256);

    this.btnCredit9.Name = "btnCredit9";

    this.btnCredit9.Size = new System.Drawing.Size(56, 48);

    this.btnCredit9.TabIndex = 28;

    this.btnCredit9.Text = "9";

    this.btnCredit9.Click += new System.EventHandler(this.btnCredit9_Click);

    //

    // btnClear

    //

    this.btnClear.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnClear.Location = new System.Drawing.Point(56, 304);

    this.btnClear.Name = "btnClear";

    this.btnClear.Size = new System.Drawing.Size(56, 48);

    this.btnClear.TabIndex = 29;

    this.btnClear.Text = "Clear";

    this.btnClear.Click += new System.EventHandler(this.btnClear_Click);

    //

    // btnCredit0

    //

    this.btnCredit0.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

    this.btnCredit0.Location = new System.Drawing.Point(112, 304);

    this.btnCredit0.Name = "btnCredit0";

    this.btnCredit0.Size = new System.Drawing.Size(56, 48);

    this.btnCredit0.TabIndex = 30;

    this.btnCredit0.Text = "0";

    this.btnCredit0.Click += new System.EventHandler(this.btnCredit0_Click_1);

    //

    // CreditCharges

    //

    this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

    this.ClientSize = new System.Drawing.Size(280, 398);

    this.Controls.Add(this.btnCredit0);

    this.Controls.Add(this.btnClear);

    this.Controls.Add(this.btnCredit9);

    this.Controls.Add(this.btnCredit8);

    this.Controls.Add(this.btnCredit7);

    this.Controls.Add(this.btnCredit6);

    this.Controls.Add(this.btnCredit5);

    this.Controls.Add(this.btnCredit4);

    this.Controls.Add(this.btnCredit3);

    this.Controls.Add(this.btnCredit2);

    this.Controls.Add(this.btnCredit1);

    this.Controls.Add(this.lblChargeType);

    this.Controls.Add(this.btnDebit);

    this.Controls.Add(this.btnCredit);

    this.Controls.Add(this.lblActiveID);

    this.Controls.Add(this.btnCancel);

    this.Controls.Add(this.txtSecureInfo);

    this.Controls.Add(this.label2);

    this.Controls.Add(this.btnCreditEnter);

    this.MaximizeBox = false;

    this.MinimizeBox = false;

    this.Name = "CreditCharges";

    this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;

    this.Text = "CreditCharges";

    this.ResumeLayout(false);

    }

    #endregion

    private void btnCredit0_Click(object sender, System.EventArgs e)

    {

    }

    private void btnCreditEnter_Click(object sender, System.EventArgs e)

    {

    if(txtSecureInfo.Text == "")

    {

    MessageBox.Show("Please Enter Credit Number Or Cancel This Action Thank You?",

    "Credit Not Found",MessageBoxButtons.OK, MessageBoxIcon.Stop);

    }

    else if(txtSecureInfo.Text == strCredit)

    {

    PinNumberUpdate();

    this.Close();

    }

    this.PinNum = txtSecureInfo.Text;

    this.CreditNum = txtSecureInfo.Text;

    }

    private void PinNumberUpdate()

    {

    if(txtSecureInfo.Text == "")

    {

    MessageBox.Show("Enter ID Pin Number To Correctly Charge Customer","Form Error",MessageBoxButtons.OK, MessageBoxIcon.Error);

    }

    else

    {

    objUpdatePin.Parameters["Original_ActiveID"].Value = lblActiveID.Text;

    objUpdatePin.Parameters["PinNumber"].Value = Convert.ToString(txtSecureInfo.Text);

    objTransaction.Open(); // open database connection

    objUpdatePin.ExecuteNonQuery();

    objTransaction.Close(); // close database connection

    }

    } // end method

    private void btnCancel_Click(object sender, System.EventArgs e)

    {

    this.Close();

    }

    private void btnCredit_Click(object sender, System.EventArgs e)

    {

    lblChargeType.Text = "Credit";

    this.PayOption = lblChargeType.Text;

    }

    private void btnDebit_Click(object sender, System.EventArgs e)

    {

    lblChargeType.Text = "Debit";

    this.PayOption = lblChargeType.Text;

    }

    private void btnCredit1_Click(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredeit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "1";

    txtSecureInfo.Text = strCredit;

    }

    private void btnCredit2_Click(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredeit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "2";

    txtSecureInfo.Text = strCredit;

    }

    private void btnCredit3_Click(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredeit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "3";

    txtSecureInfo.Text = strCredit;

    }

    private void btnCredit4_Click(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredeit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "4";

    txtSecureInfo.Text = strCredit;

    }

    private void btnCredit5_Click(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "5";

    txtSecureInfo.Text = strCredit;

    }

    private void btnCredit6_Click(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredeit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "6";

    txtSecureInfo.Text = strCredit;

    }

    private void btnCredit7_Click(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredeit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "7";

    txtSecureInfo.Text = strCredit;

    }

    private void btnCredit8_Click(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredeit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "8";

    txtSecureInfo.Text = strCredit;

    }

    private void btnCredit9_Click(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredeit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "9";

    txtSecureInfo.Text = strCredit;

    }

    private void btnClear_Click(object sender, System.EventArgs e)

    {

    txtSecureInfo.Text = "";

    strCredit = "";

    }

    private void btnCredit0_Click_1(object sender, System.EventArgs e)

    {

    //Note Transfer info from form to main using summary

    //Note Transfer intCredeit to a secure location with disposing

    //Actual Numbers

    //transfer to SubSecure area

    strCredit += "0";

    txtSecureInfo.Text = strCredit;

    }

    }

    }

    The high lighted yellow is the error system.StackOverFlow Error where am I am Recursive with this event trigger

    if you notice i have different buttons adding an assignment operator so that my credit program acts like a puchkey pad adding numbers to the textbox object

    Thursday, August 31, 2006 12:02 AM
  • Hey, Dude Thanks alot I found what the problem was by using the step into or by steping through as you said the problem is the main form the first opening form class can not be inherited

    I tried creating an instance of the main form in a child form or secondary operational form like this

    form1 myForm = new form1();

    I tried adding this in one of my other form in my project so that i could use the get and set function to recieve information

    to display in the other form but the problem was i can call that form for some reason it is telling me that this class can not be inherited so i erased it and it solved my problems.

    Thursday, August 31, 2006 12:23 AM
  • using System;
    using System.Data;
    using System.Configuration;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using System.Data.SqlClient;

    /// <summary>
    /// Summary description for BLPurchaseOrder
    /// </summary>
    public class BLPurchaseOrder
    {
        #region "Private Variables"
        private string mPOdate;
        private string mSupplier;
        private string mPart;
        private string mItem;
        private string mrfqref;
        private string mqty;
        private string mpurchaser;
        private string mqtyOffer;
        private string mPOnumber;
        private string mCustPOnum;
        private string mTargetPrice;
        private string mOfferPrice;
        private string mQuotedPrice;
        private string mStatus;
        private string mDescription;
        private string mItemCondition;
        private string mPOID;

        DB objdb = new DB();
        #endregion

        #region "Constructor"
        public BLPurchaseOrder()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        #endregion

        #region "Public Functions"

        public DataTable SearchPO()
        {
            try
            {
                SqlCommand oCmd = new SqlCommand();
                oCmd.Parameters.Add("@Supplier", SqlDbType.VarChar).Value = this.Supplier;
                oCmd.Parameters.Add("@Part", SqlDbType.VarChar).Value = this.Part;
                oCmd.Parameters.Add("@Date", SqlDbType.VarChar).Value = this.PODate;
               
                oCmd.Parameters.Add("@Item", SqlDbType.VarChar).Value = this.Item;
                oCmd.Parameters.Add("@RFQref", SqlDbType.VarChar).Value = this.RFQRef;
                oCmd.Parameters.Add("@Quantity", SqlDbType.VarChar).Value = this.Quantity;
                oCmd.Parameters.Add("@Purchaser", SqlDbType.VarChar).Value = this.Purchaser;
                oCmd.Parameters.Add("@QtyOffer", SqlDbType.VarChar).Value = this.QuantityOffer;
                oCmd.Parameters.Add("@PONumber", SqlDbType.VarChar).Value = this.PONumber;
                oCmd.Parameters.Add("@CustPONumber", SqlDbType.VarChar).Value = this.CustomerPONumber;
                oCmd.Parameters.Add("@TargetPrice", SqlDbType.VarChar).Value = this.TargetPrice;
                oCmd.Parameters.Add("@OfferPrice", SqlDbType.VarChar).Value = this.OfferPrice;
                oCmd.Parameters.Add("@QuotedPrice", SqlDbType.VarChar).Value = this.QuotedPrice;

                return (objdb.GetTablebyStoredProcedure(oCmd, "SearchPurchaseOrder"));

            }
            catch (Exception e1)
            {
                throw e1;
            }
        }

        public DataTable GetPODetailsByID(string id)
        {
            try
            {
                SqlCommand oCmd = new SqlCommand();
                oCmd.Parameters.Add("@PONumber", SqlDbType.BigInt).Value = id;
                return (objdb.GetTablebyStoredProcedure(oCmd, "GetPODetailsByID"));
            }
            catch (Exception e1)
            {
                throw e1;
            }
        }

        public DataTable GetAllSuppliersForCmb()
        {
            try
            {
                return (objdb.GetTablebySimpleStoredProcedure("GetAllSupplierForCmb"));
            }
            catch (Exception e1)
            {
                throw e1;
            }
        }

        public bool UpdatePurchaseOrder()
        {
            try
            {
                SqlCommand oCmd = new SqlCommand();
                oCmd.Parameters.Add("@Supplier", SqlDbType.Int).Value = this.Supplier;
                oCmd.Parameters.Add("@Part", SqlDbType.VarChar).Value = this.Part;
                oCmd.Parameters.Add("@Date", SqlDbType.SmallDateTime).Value = this.PODate;
                oCmd.Parameters.Add("@Desc", SqlDbType.VarChar).Value = this.Description;
                oCmd.Parameters.Add("@Item", SqlDbType.Int).Value = this.Item;
                oCmd.Parameters.Add("@ItemCond", SqlDbType.VarChar).Value = this.ItemCondition;
                oCmd.Parameters.Add("@RFQref", SqlDbType.VarChar).Value = this.RFQRef;
                oCmd.Parameters.Add("@Quantity", SqlDbType.Int).Value = this.Quantity;
                oCmd.Parameters.Add("@Purchaser", SqlDbType.VarChar).Value = this.Purchaser;
                oCmd.Parameters.Add("@QtyOffer", SqlDbType.Int).Value = this.QuantityOffer;
                oCmd.Parameters.Add("@PONumber", SqlDbType.VarChar).Value = this.PONumber;
                oCmd.Parameters.Add("@CustPONumber", SqlDbType.VarChar).Value = this.CustomerPONumber;
                oCmd.Parameters.Add("@TargetPrice", SqlDbType.Int).Value = this.TargetPrice;
                oCmd.Parameters.Add("@OfferPrice", SqlDbType.Int).Value = this.OfferPrice;
                oCmd.Parameters.Add("@QuotedPrice", SqlDbType.Int).Value = this.QuotedPrice;
                oCmd.Parameters.Add("@Status", SqlDbType.VarChar).Value = this.Status;

                oCmd.Parameters.Add("@POID", SqlDbType.Int).Value = this.POID;

                return (objdb.InsertDeleteStoredProcedure(oCmd, "UpdatePO"));
            }
            catch (Exception e1)
            {
                throw e1;
            }
        }

        #endregion

        #region "Public Properties"

        public string POID
        {
            get { return this.POID; }
            set { this.POID = value; }
        }

        public string ItemCondition
        {
            get { return this.mItemCondition; }
            set { this.mItemCondition = value; }
        }

        public string Description
        {
            get { return this.mDescription; }
            set { this.mDescription = value; }
        }

        public string Status
        {
            get { return this.mStatus; }
            set { this.mStatus = value; }
        }

        public string QuotedPrice
        {
            get { return mQuotedPrice; }
            set { mQuotedPrice = value; }
        }

        public string OfferPrice
        {
            get { return mOfferPrice; }
            set { mOfferPrice = value; }
        }

        public string TargetPrice
        {
            get { return mTargetPrice; }
            set { mTargetPrice = value; }
        }

        public string CustomerPONumber
        {
            get { return mCustPOnum; }
            set { mCustPOnum = value; }
        }

        public string PONumber
        {
            get { return mPOnumber; }
            set { mPOnumber = value; }
        }

        public string QuantityOffer
        {
            get { return mqtyOffer; }
            set { mqtyOffer = value; }
        }

        public string Purchaser
        {
            get { return mpurchaser; }
            set { mpurchaser = value; }
        }

        public string Quantity
        {
             get { return mqty; }
            set { mqty = value; }
        }

        public string RFQRef
        {
            get { return mrfqref; }
            set { mrfqref = value; }
        }

        public string Item
        {
            get { return mItem; }
            set { mItem = value; }
        }

        public string PODate
        {
            get { return mPOdate; }
            set { mPOdate = value; }
        }

        public string Supplier
        {
            get { return mSupplier; }
            set { mSupplier = value; }
        }

        public string Part
        {
            get { return mPart; }
            set { mPart = value; }
        }
        #endregion
    }




    im getting this exception An unhandled exception of type 'System.StackOverflowException' occurred in App_Code.gxmd-7kn.dll  at   set { this.POID = value; } some 1 please solve my problem .........

    Monday, April 20, 2009 11:07 AM