Forum guidelines
AuthorQuestion
System.StackOverflowException
Posted on: 13 Dec 2012
Plz help me.............
I am getting an error

An unhandled exception of type 'System.StackOverflowException' occurred in ShizheDLL.dll

in the page

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using SHIZHE;
//using SHIZHEBL;
namespace ShizheDLL
{
    public class ItemMasterDL
    {
    
    #region Declaration
        ItemMasterDL objItemMasterDL = new ItemMasterDL();
        int iItemId = 0;
        int mode = 0;
        string vProductCode = string.Empty;
        string vPrductName = string.Empty;
        string vUnit = string.Empty;
        double fTaxPercentage = 0;
        double dDealerPrice = 0;
        double dMRP = 0;
        int iScheduleEntryNo = 0;
        string vHSNcode = string.Empty;
        int iPointValue = 0;
        int iBusinessVolume = 0;
        string vSticker = string.Empty;

    #endregion

    #region Property

        public int ItemId
        {
            get
            {
                return iItemId;
            }
            set
            {
                iItemId = value;
            }
        }

        public int Mode
        {
            get
            {
                return mode ;
            }
            set
            {
                mode  = value;
            }
        }

        public string ProductCode
        {
            get
            {
                return vProductCode;
            }
            set
            {
                vProductCode = value;
            }
        }

        public string PrductName
        {
            get
            {
                return vPrductName;
            }
            set
            {
                vPrductName = value;
            }
        }

        public string Unit
        {
            get
            {
                return vUnit;
            }
            set
            {
                vUnit = value;
            }
        }

        public double TaxPercentage
        {
            get
            {
                return fTaxPercentage;
            }
            set
            {
                fTaxPercentage = value;
            }
        }

        public double DealerPrice
        {
            get
            {
                return dDealerPrice;
            }
            set
            {
                dDealerPrice = value;
            }
        }

        public double MRP
        {
            get
            {
                return dMRP;
            }
            set
            {
                dMRP = value;
            }
        }

        public int ScheduleEntryNo
        {
            get
            {
                return iScheduleEntryNo;
            }
            set
            {
                iScheduleEntryNo = value;
            }
        }

        public string HSNcode
        {
            get
            {
                return vHSNcode;
            }
            set
            {
                vHSNcode = value;
            }
        }

        public int PointValue
        {
            get
            {
                return iPointValue;
            }
            set
            {
                iPointValue = value;
            }
        }

        public int BusinessVolume
        {
            get
            {
                return iBusinessVolume;
            }
            set
            {
                iBusinessVolume = value;
            }
        }

        public string Sticker
        {
            get
            {
                return vSticker;
            }
            set
            {
                vSticker = value;
            }
        }

    #endregion

    #region Methodes

        public int InsertUpdateItemMaster()
        {
            Connection con = new Connection();

            SqlParameter[] parmItemMaster = new SqlParameter[13];

            parmItemMaster[0] = new SqlParameter();
            parmItemMaster[0].SqlDbType = SqlDbType.Int;
            parmItemMaster[0].ParameterName = "@iItemId";
            parmItemMaster[0].Value = ItemId;

            parmItemMaster[1] = new SqlParameter();
            parmItemMaster[1].SqlDbType =SqlDbType .VarChar ;
            parmItemMaster[1].ParameterName ="@vProductCode";
            parmItemMaster[1].Value =ProductCode;

            parmItemMaster[2] = new SqlParameter();
            parmItemMaster[2].SqlDbType =SqlDbType .VarChar ;
            parmItemMaster[2].ParameterName ="@vPrductName";
            parmItemMaster[2].Value =PrductName;

            parmItemMaster[3] = new SqlParameter();
            parmItemMaster[3].SqlDbType =SqlDbType .VarChar ;
            parmItemMaster[3].ParameterName ="@vUnit";
            parmItemMaster[3].Value =Unit;

            parmItemMaster[4] = new SqlParameter();
            parmItemMaster[4].SqlDbType =SqlDbType.Float ;
            parmItemMaster[4].ParameterName ="@fTaxPercentage";
            parmItemMaster[4].Value =TaxPercentage;

            parmItemMaster[5] = new SqlParameter();
            parmItemMaster[5].SqlDbType =SqlDbType.Decimal ;
            parmItemMaster[5].ParameterName ="@dDealerPrice";
            parmItemMaster[5].Value =DealerPrice;

            parmItemMaster[6] = new SqlParameter();
            parmItemMaster[6].SqlDbType =SqlDbType.Decimal ;
            parmItemMaster[6].ParameterName ="@dMRP";
            parmItemMaster[6].Value =MRP;


            parmItemMaster[7] = new SqlParameter();
            parmItemMaster[7].SqlDbType =SqlDbType .Int  ;
            parmItemMaster[7].ParameterName ="@iScheduleEntryNo";
            parmItemMaster[7].Value =ScheduleEntryNo;

            parmItemMaster[8] = new SqlParameter();
            parmItemMaster[8].SqlDbType =SqlDbType .VarChar ;
            parmItemMaster[8].ParameterName ="@vHSNcode";
            parmItemMaster[8].Value =HSNcode;

            parmItemMaster[9] = new SqlParameter();
            parmItemMaster[9].SqlDbType =SqlDbType .Int ;
            parmItemMaster[9].ParameterName ="@iPointValue";
            parmItemMaster[9].Value =PointValue;

            parmItemMaster[10] = new SqlParameter();
            parmItemMaster[10].SqlDbType =SqlDbType .Int;
            parmItemMaster[10].ParameterName ="@iBusinessVolume";
            parmItemMaster[10].Value =BusinessVolume;

            parmItemMaster[11] = new SqlParameter();
            parmItemMaster[11].SqlDbType =SqlDbType .VarChar ;
            parmItemMaster[11].ParameterName ="@vSticker";
            parmItemMaster[11].Value =Sticker;

            parmItemMaster[12] = new SqlParameter();
            parmItemMaster[12].SqlDbType = SqlDbType.Int;
            parmItemMaster[12].ParameterName = "@mode";
            parmItemMaster[12].Value = Mode;

            int iStatus = con.insUpdata("sp_InsertUpdateItemMaster", parmItemMaster);

            return iStatus;
        }
     
    #endregion


    }
}


AuthorReply
Re: System.StackOverflowException
Posted on: 13 Dec 2012  
The stack overflow is being caused by this line:

  ItemMasterDL objItemMasterDL = new ItemMasterDL();

As it doesn't appear to be serving any useful purpose, removing it should solve the problem.

SPONSORED BY

Offshore Software and Database Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.