Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does OleDBDataReader.Close() release object?
Message
 
To
05/02/2003 08:57:35
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00749034
Message ID:
00749403
Views:
25
Garbage Collection is handled by .NET automatically and not by settings. How much memory does your machine have? .NET applications are best run when the machine has lots of memory to use.

>Cathi,
>
>Thanks for the info. We have an application that is running slowly. A Microsoft engineer tells us that 40% of the CPU time is consumed by garbage collection. Is this controlled by the application or are there settings in a configuration file? I was asking the above question, because several (many) datareaders are created and closed, but not explicitly released.
>
>
>Any ideas?
>
>TIA
>
>Rex
>
>
>
>Thanks
>
>>Rex,
>>
>>The Close method closes the connection but the class is still in scope. You can link two selects in one DataReader like the following. The NextResult method starts iterating the next statement:
>>
>>
>>strSQL = "SELECT * FROM Customers;SELECT * FROM Orders";
>>OleDbCommand cmd = new OleDbCommand(strSQL,cn);
>>OleDbDataReader rdr = cmd.ExecuteReader();
>>do
>>{
>>    while (rdr.Read())
>>    {
>>        // Process results
>>        Console.WriteLine("\t" + rdr.GetName[0].ToString() +
>>                          " - " + rdr.GetValue[0].ToString());
>>    }
>>}
>>while (rdr.NextResult());
>>
>>
>>>All,
>>>
>>>I am revamping an application written by a contractor. They use several OleDbDataReaders to load data into drop down lists, creating a datareader, populating it, using it as a datasource for the drop down, binding the drop down, then closing the datareader, then creating the next datareader. Does the datareader.close clear the object from memory? Is there a problem creating the second datareader using the same name as the first?
>>>
>>>Thanks
>>>
>>>Rex
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform