Solved

Help with system.outofmemory error - Do While Loop

Posted on 2011-09-20
2
147 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now