Unanswered: Multiple ADODC with the same connectionstring, how?
Could someone help me on how to pass global variable to ADODC controls and DataEnv programatically or during design time? I would like to specify the server name and database name at the main form_load. When I create a new ADODC I would like to be able to pass the string to the properties page.
Right now, whenever I create a new ADODC or DataEnv I have to rebuild the connection string:
Originally posted by rnealejr
Can you give an example of what you are trying to accomplish ? You mention design-time and programmatically.
I develop VB interface on a personal SQL server on VAIO. The production machine is called WAREHOUSE.
On VAIO, I have an interface with several screens on each of them I have ADODC controls. When I rig them at design time, I have to build the connectionstring (on the control's Property box). (1) Right now I have to repeat the build when I add new ADODC/DataEnv (for reports) - usually it is the same string. Is there anyway to point to the pre-defined connectionstring in the property pages? (2) When I go to WAREHOUSE, I have to go to each ADODC and change VAIO to WAREHOUSE. Is there a efficient way to change VAIO to WAREHOUSE programatically so that all the controls update their connectionstring?
I have the same situation in one of my applications. The connections and database locations could change and I didn't want to recompile my application every time something changed.
I established a small database called "Pathnames". It contains three fields: FileName, FileUsage and FilePath. The FileName/FileUsage is hard coded in the application "MyReport/Production". The FilePath is retrieved from the database when the application is loaded and put into the connection string or database pathname as needed.
That way, you can change the connection strings or database locations without recompiling the application. I also used "Test" to point to a different database for user training and testing.
Great Idea, Bruce. This should wok for sending the application from machine to machine. I will work this into mine and post my result here.
On the second topic, once you retrieve the connectionstring details from the table, how would you pass it to DataEnv object or ADODC control?