Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2002
    Location
    Maryland
    Posts
    4

    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:

    GlobalConn = "Provider=SQLOLEDB.1;Password=******;Persist Security Info=True;User ID=satya;Initial Catalog=TestPak;Data Source=vaio"

    Thanks for your help.
    Satya

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Can you give an example of what you are trying to accomplish ? You mention design-time and programmatically.

  3. #3
    Join Date
    Nov 2002
    Location
    Maryland
    Posts
    4

    multiple ADODC...

    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?

    Thanks for your help.

    Satya

  4. #4
    Join Date
    Nov 2002
    Location
    Ohio
    Posts
    90
    Hi Satya,

    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.

    Good Luck,
    Bruce Baasch

  5. #5
    Join Date
    Nov 2002
    Location
    Maryland
    Posts
    4
    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?

  6. #6
    Join Date
    Nov 2002
    Location
    Maryland
    Posts
    4
    An Update:

    What is working for me is creating an UDL file
    -Right Click on the desktop and choose Datalink file option
    -If the option is not there one has to load the NewUDL file option
    into the registry.

    -Choose the server, database etc. and click OK
    -A datalink file will be created on your desktop.

    -In VB,
    rig the ADODC control at design time by choosing the first option
    for UDL instead of a DSN or building the connectionstring.

    Now, when I want to connect to a different machine all I have to do
    is create another datalink file.

    Hope this UDL option is latest technology and it won't be phased out.

    Hope this helps someone else.

    Satya

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •