I currently have a class with 29 data adapters and I will probably add
a few more as time goes on. When I was testing earlier, i had 28 of
them pointing to one connection and 1 pointing to a different one by
mistake. This really caused some confusion for a while. What I would
like to do is use reflection to have the object scan itself and pick
out all of the data adapters and then for each set the connection for
all of the various command objects so they will be the same.
class MyDataManager
{
OleDbDataAdapter _daOne;
OleDbDataAdapter _daTwo;
// and so on
OleDbConnection _dbConn;
private void SetConnections()
{
foreach( OleDbDataAdapter v_da in method_to_get_data_adapters()
)
{
if( v_da.SelectCommand != null )
v_da.SelectCommand.Connection = _dbConn;
// and so on..
}
}
}
could someone please show me how to code the method
method_to_get_data_adapters(). I've tried it and I can't seem to get
it to work right.
gkelly