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())
{
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.comwww.prenia.comWeblog: blogs.prenia.com/cathi