Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does OleDBDataReader.Close() release object?
Message
 
To
04/02/2003 15:19:49
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00749034
Message ID:
00749063
Views:
28
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
Next
Reply
Map
View

Click here to load this message in the networking platform