Solved

Help with system.outofmemory error - Do While Loop

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

825 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