Hi,
I have an application that connects to a SQL database, and based on the contents of one of the tables, then has to connect to other databases, and run various scripts.
However, until I connect to that first database, I have no idea what the other databases are called, or how many there are.
Currently, when I query the table in the first database, I write the values of the other databases to an array.
This then means that I know all the names, and the number of other SQL databases that exist.
I then loop through the array, and change the properties of my sqlconnection to reflect the database details in the current element of the array.
This works fine, and provides me with all the results that I require.
However, I now need to include a background worker process in my app so that I can display a progress bar while the result fetching takes place.
However, once I use a background worker thread, I have found that I am unable to change the sqlconnection properties to connect to a different database.
I was unable to find a way around this, so then tried to declare the connections to the databases individually as soon as the results from the first database table are returned.
However, that's not really working out too well.
So, basically, I need some ideas on how to connect to multiple databases, when I don't know the names of the databases or the number of databases.
Alternatively, if anyone can throw me some ideas on why my background worker thread won't let me change the sqlconnection properties, that would probably be ideal.
Thank you
I have an application that connects to a SQL database, and based on the contents of one of the tables, then has to connect to other databases, and run various scripts.
However, until I connect to that first database, I have no idea what the other databases are called, or how many there are.
Currently, when I query the table in the first database, I write the values of the other databases to an array.
This then means that I know all the names, and the number of other SQL databases that exist.
I then loop through the array, and change the properties of my sqlconnection to reflect the database details in the current element of the array.
This works fine, and provides me with all the results that I require.
However, I now need to include a background worker process in my app so that I can display a progress bar while the result fetching takes place.
However, once I use a background worker thread, I have found that I am unable to change the sqlconnection properties to connect to a different database.
I was unable to find a way around this, so then tried to declare the connections to the databases individually as soon as the results from the first database table are returned.
However, that's not really working out too well.
So, basically, I need some ideas on how to connect to multiple databases, when I don't know the names of the databases or the number of databases.
Alternatively, if anyone can throw me some ideas on why my background worker thread won't let me change the sqlconnection properties, that would probably be ideal.
Thank you