Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does OleDBDataReader.Close() release object?
Message
From
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:
00749317
Views:
23
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform