I am trying to change the connect string for a series of Pass Through queries in a database, so that the end user can choose between Prod and Test DA Sources.
I believe that the connect string is read only for an existing query, so I am capturing the Prod and Test connect strings, the SQL from the query, and the query name as variables, deleting and recreating the query, looping through the qdefs collection and trying to set the connect string of the newly created query based upon the choice of the user.
I have 2 problems:
1) As you delete and recreate the first query, the number of query defs in the collection increases, so you end up looping round the same query over and over and
2) It seems to set the connect string to the same as the deleted query, irrespective of what is contained in the connect string variable used.
Any help would be appreciated.
Andy

I believe that the connect string is read only for an existing query, so I am capturing the Prod and Test connect strings, the SQL from the query, and the query name as variables, deleting and recreating the query, looping through the qdefs collection and trying to set the connect string of the newly created query based upon the choice of the user.
I have 2 problems:
1) As you delete and recreate the first query, the number of query defs in the collection increases, so you end up looping round the same query over and over and
2) It seems to set the connect string to the same as the deleted query, irrespective of what is contained in the connect string variable used.
Any help would be appreciated.
Andy
