Out Of Memory Error
Posted: Tue  03 Sep 2013 23:33
				
				Sirs,
I am reading in US postal codes and some other data from a Excel Spreadsheet that contains 16 Columns and 80108 rows. I would like to read in all of the objects first and then do one write to the database using the dotConnect Entities framework latest download. But, this keeps error-ing out, so I tried this:
 
And it keeps error-ing with a Out Of Memory error at object 31,403 now if I comment out the context.SaveChanges() it will load all the objects just fine.
So what am I doing wrong?
Thanks,
Ashley
			I am reading in US postal codes and some other data from a Excel Spreadsheet that contains 16 Columns and 80108 rows. I would like to read in all of the objects first and then do one write to the database using the dotConnect Entities framework latest download. But, this keeps error-ing out, so I tried this:
Code: Select all
 while (!String.IsNullOrEmpty(Sheet.getText(intIndex, 0)))
                    {
                        ZIPSEntities context = new ZIPSEntities();
                        var LocalZIPS = context.CreateObjectSet<ZIPS>();
                        LocalZIPS.AddObject(new ZIPS
                        {
                            strZIPCode = Sheet.getText(intIndex, 0),
                            strZIPType = Sheet.getText(intIndex, 1),
                            strCityName = Sheet.getText(intIndex, 2),
                            strCityType = Sheet.getText(intIndex, 3),
                            strCountyName = Sheet.getText(intIndex, 4),
                            strCountyFIPS = Sheet.getText(intIndex, 5),
                            strStateName = Sheet.getText(intIndex, 6),
                            strStateAbbr = Sheet.getText(intIndex, 7),
                            strStateFIPS = Sheet.getText(intIndex, 8),
                            strMSACode = Sheet.getText(intIndex, 9),
                            strAreaCode = Sheet.getText(intIndex, 10),
                            strTimeZone = Sheet.getText(intIndex, 11),
                            strUTC = Sheet.getText(intIndex, 12),
                            strDST = Sheet.getText(intIndex, 13),
                            longLatitude = Sheet.getNumber(intIndex, 14),
                            longLongitude = Sheet.getNumber(intIndex, 15)
                        });
                            intIndex++;
                            label1.Text = intIndex.ToString();
                            label1.Update();
                            context.SaveChanges();
                    }
                    Sheet.Dispose();
                    label1.Text = "Finished";
                    label1.Update();
                }
            } And it keeps error-ing with a Out Of Memory error at object 31,403 now if I comment out the context.SaveChanges() it will load all the objects just fine.
So what am I doing wrong?
Thanks,
Ashley