Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1510
'System.OutOfMemoryException' when databinding to 201.293 rows
posted

Hi there !

Why am I getting a 'System.OutOfMemoryException' error while "only" loading 201.293 rows ??

I'm binding to a custom datasource ( just a regular data class ) in-code, behind a search button ... please help !!!
( I've turned off the viewstate for the Grid to try to load data faster ... doesn't make any difference ! )

What am I doing wrong ??

protected void _btnSearch_Click(object sender, EventArgs e)
        {
            if( (_tbBankanumer.Text == string.Empty) || (_tbHofudbok.Text == string.Empty) || (_tbReikningur.Text == string.Empty) )
            {
                _lblBankanumerHofudbokReikningur.Text = "Please don't leave Bankanúmer, Höfuðbók or Reikningur empty - too much data to export to Excel!";
                return;
            }

            //1/1/1753 12:00:00 AM and 12/31/9999

            DateTime dagsFra = new DateTime(1753,1,1);
            DateTime dagsTil = new DateTime(9999,12,31);

            string bankanumer = _tbBankanumer.Text.Trim();           
            string hofudbok = _tbHofudbok.Text.Trim();           
            string reikningsnumer = _tbReikningur.Text.Trim();
           
            if( _dateDagsetningFra.Value != null )
                dagsFra = (DateTime)_dateDagsetningFra.Value;
            if( _dateDagsetningTil.Value != null )
                dagsTil = (DateTime)_dateDagsetningTil.Value;

            _transactions = TrackingService.GetAllAKTransactionTracksBySearchCriteria(bankanumer, hofudbok, reikningsnumer, dagsFra, dagsTil);           
           
            Cache["dataFromGrid"] = _transactions; //I've tried taking this out to check if this matters ... doesn't change anything. I'm caching it so I can export the results to Excel later on !

            if (_transactions.Count > 0)
            {
                _ugTransactions.DataSource = _transactions; // 201.293 rows
                _ugTransactions.DataBind(); //this will throw 'System.OutOfMemoryException' !!!!!
            }           

            _lblRows.Text = "Færslur úr leit: ";
            _lblRowCount.Text = _ugTransactions.Rows.Count.ToString();

            Logger log = getLoggingDetails("RB Færslur", "Search for data");
            TrackingService.LogIntoDatabase(log);
            _lblBankanumerHofudbokReikningur.Text = String.Empty;
        }

rgd,
EE.

Parents
  • 1510
    posted

    This is my Initilize-Layout function:

    _ugTransactions_InitializeLayout:
    ------------------------------------------------

     protected void _ugTransactions_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)
            {
                e.Layout.Bands[0].AllowSorting = Infragistics.WebUI.UltraWebGrid.AllowSorting.OnClient;
                e.Layout.Bands[0].AllowColSizing = Infragistics.WebUI.UltraWebGrid.AllowSizing.Fixed;
                e.Layout.Bands[0].AllowColumnMoving = Infragistics.WebUI.UltraWebGrid.AllowColumnMoving.None;

                e.Layout.Bands[0].Columns.FromKey("TransTrackId").Hidden = true;
                e.Layout.Bands[0].Columns.FromKey("KeyrtIVoruhus").Hidden = true;

                e.Layout.Bands[0].Columns.FromKey("Bankanumer").Header.Caption = "Banki";
                e.Layout.Bands[0].Columns.FromKey("Bankanumer").Width = 50;

                e.Layout.Bands[0].Columns.FromKey("Hofudbok").Header.Caption = "HB";
                e.Layout.Bands[0].Columns.FromKey("Hofudbok").Width = 20;

                e.Layout.Bands[0].Columns.FromKey("Reikningsnumer").Header.Caption = "Reikningsnúmer";

                e.Layout.Bands[0].Columns.FromKey("Faerslulykill").Header.Caption = "Færsulykill";
                e.Layout.Bands[0].Columns.FromKey("Faerslulykill").Width = 60;

                e.Layout.Bands[0].Columns.FromKey("Upphaed").Header.Caption = "Upphæð";
                e.Layout.Bands[0].Columns.FromKey("Textalykill").Header.Caption = "Textalykill";
                e.Layout.Bands[0].Columns.FromKey("Tekkanumer").Header.Caption = "Tékkanúmer";
                e.Layout.Bands[0].Columns.FromKey("Tilvisun").Header.Caption = "Tilvísun";
                e.Layout.Bands[0].Columns.FromKey("Faersludagur").Header.Caption = "Færsludagur";
                e.Layout.Bands[0].Columns.FromKey("Innlausnarbanki").Header.Caption = "Innlausnarbanki";
                e.Layout.Bands[0].Columns.FromKey("Bunkanumer").Header.Caption = "Bunkanúmer";
                e.Layout.Bands[0].Columns.FromKey("TegundInntaks").Header.Caption = "TegundInntaks";
                e.Layout.Bands[0].Columns.FromKey("RBMatchStatus").Header.Caption = "RBMatchStatus";
                e.Layout.Bands[0].Columns.FromKey("MotBankanumer").Header.Caption = "MótBankanúmer";
                e.Layout.Bands[0].Columns.FromKey("MotHofudbok").Header.Caption = "MótHöfuðbók";
                e.Layout.Bands[0].Columns.FromKey("MotReikningsnumer").Header.Caption = "MótReikningsnúmer";
                e.Layout.Bands[0].Columns.FromKey("MotFaerslulykill").Header.Caption = "MótFærslulykill";
                e.Layout.Bands[0].Columns.FromKey("MotTextalykill").Header.Caption = "MótTextalykill";
                e.Layout.Bands[0].Columns.FromKey("MotTekkanumer").Header.Caption = "MótTékkanúmer";
                e.Layout.Bands[0].Columns.FromKey("MotTilvisun").Header.Caption = "MótTilvísun";
                e.Layout.Bands[0].Columns.FromKey("MotBunkanumer").Header.Caption = "MótBunkanúmer";
                e.Layout.Bands[0].Columns.FromKey("MotKennitala").Header.Caption = "MótKennitala";
                e.Layout.Bands[0].Columns.FromKey("MotNafn").Header.Caption = "MótNafn"; //Mótnafn

                e.Layout.Bands[0].Columns.FromKey("AKMatchStatus").Header.Caption = "AKMatchStatus";
                e.Layout.Bands[0].Columns.FromKey("AKMatchRunDate").Header.Caption = "AKMatchRunDate";
                e.Layout.Bands[0].Columns.FromKey("IBASMatchStatus").Header.Caption = "IBASMatchStatus";
                e.Layout.Bands[0].Columns.FromKey("IBASMatchRunDate").Header.Caption = "IBASMatchRunDate";
                e.Layout.Bands[0].Columns.FromKey("Reiknnumid").Header.Caption = "Reiknnumid";
                e.Layout.Bands[0].Columns.FromKey("MotReiknnumid").Header.Caption = "MótReiknnumid";

                e.Layout.Bands[0].Columns.FromKey("Bankanumer").Move(1);
                e.Layout.Bands[0].Columns.FromKey("Hofudbok").Move(2);
                e.Layout.Bands[0].Columns.FromKey("Reikningsnumer").Move(3);
                e.Layout.Bands[0].Columns.FromKey("Faerslulykill").Move(4);
                e.Layout.Bands[0].Columns.FromKey("Upphaed").Move(5);
                e.Layout.Bands[0].Columns.FromKey("MotBankanumer").Move(6);
                e.Layout.Bands[0].Columns.FromKey("MotHofudbok").Move(7);
                e.Layout.Bands[0].Columns.FromKey("MotReikningsnumer").Move(8);
                e.Layout.Bands[0].Columns.FromKey("MotKennitala").Move(9);
                e.Layout.Bands[0].Columns.FromKey("MotNafn").Move(10);
                e.Layout.Bands[0].Columns.FromKey("Textalykill").Move(11);
                e.Layout.Bands[0].Columns.FromKey("Tekkanumer").Move(12);
                e.Layout.Bands[0].Columns.FromKey("Tilvisun").Move(13);
                e.Layout.Bands[0].Columns.FromKey("Faersludagur").Move(14);
                e.Layout.Bands[0].Columns.FromKey("Innlausnarbanki").Move(15);
                e.Layout.Bands[0].Columns.FromKey("Bunkanumer").Move(16);
                e.Layout.Bands[0].Columns.FromKey("TegundInntaks").Move(17);
                e.Layout.Bands[0].Columns.FromKey("RBMatchStatus").Move(18);
                e.Layout.Bands[0].Columns.FromKey("MotFaerslulykill").Move(19);
                e.Layout.Bands[0].Columns.FromKey("MotTextalykill").Move(20);
                e.Layout.Bands[0].Columns.FromKey("MotTekkanumer").Move(21);
                e.Layout.Bands[0].Columns.FromKey("MotTilvisun").Move(22);
                e.Layout.Bands[0].Columns.FromKey("MotBunkanumer").Move(23);
            }         

    and this is the data class I'm binding to if it matters ...

     public class AKTransactionTrack
        {
            private int _transTrackId;
            private string _bankanumer = String.Empty;
            private string _hofudbok = String.Empty;
            private string _reikningsnumer = String.Empty;
            private string _faerslulykill = String.Empty;
            private decimal _upphaed;
            private string _textalykill = String.Empty;
            private string _tekkanumer = String.Empty;
            private string _tilvisun = String.Empty;
            private DateTime _faersludagur;
            private string _innlausnarbanki = String.Empty;
            private string _bunkanumer = String.Empty;
            private string _tegundInntaks = String.Empty;
            private string _rBMatchStatus = String.Empty;
            private string _motBankanumer = String.Empty;
            private string _motHofudbok = String.Empty;
            private string _motReikningsnumer = String.Empty;
            private string _motFaerslulykill = String.Empty;
            private string _motTextalykill = String.Empty;
            private string _motTekkanumer = String.Empty;
            private string _motTilvisun = String.Empty;
            private string _motBunkanumer = String.Empty;
           
            private string _motKennitala = String.Empty;
            private string _motNafn = String.Empty;       

            private DateTime _keyrtIVoruhus;
            private string _aKMatchStatus = String.Empty;
            private DateTime _aKMatchRunDate;
            private string _iBASMatchStatus = String.Empty;
            private DateTime _iBASMatchRunDate;
            private int _reiknnumid;
            private int _motReiknnumid;
    }

  • 45049
    Suggested Answer
    posted in reply to Eiríkur Egilsson
Reply Children