Solved

Help with system.outofmemory error - Do While Loop

Posted on 2011-09-20
2
151 Views
Last Modified: 2012-05-12
I'm sure this is something simple but I just don't see it.  I'm getting a system.outofmemory error when I execute this script.  Can someone have a look at it and tell me what I'm doing incorrectly.  
Dim dt As New DataTable
        dt.Columns.Add("Times", GetType(String))

        Dim startTime As DateTime = "12:00 AM"

        Dim row As DataRow
        row = dt.NewRow()
        row("Times") = startTime
        dt.Rows.Add(row)

        Do While startTime <> "11:30 PM"
            row = dt.NewRow()
            startTime = startTime.AddMinutes(30)
            row("Times") = startTime
            dt.Rows.Add(row)
        Loop

        GridView1.DataSource = dt
        GridView1.DataBind()

Open in new window

0
Comment
Question by:cdemott33
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
pateljitu earned 500 total points
ID: 36568677
Whats the system configuration?

Code seems to be running fine with no error, usually this error would occur if there are too many rows to iterate through which is not the case in your code. Also is there any other code that gets execute along with this script.
0
 

Author Closing Comment

by:cdemott33
ID: 36568915
I rebooted the server and it seems to have solved the problem.  Thanks for your help.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question