If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Multiple ADODC with the same connectionstring, how?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-26-02, 19:37
psatya psatya is offline
Registered User
 
Join Date: Nov 2002
Location: Maryland
Posts: 4
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
Reply With Quote
  #2 (permalink)  
Old 11-26-02, 21:54
rnealejr rnealejr is offline
Registered User
 
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.
Reply With Quote
  #3 (permalink)  
Old 11-27-02, 09:40
psatya psatya is offline
Registered User
 
Join Date: Nov 2002
Location: Maryland
Posts: 4
multiple ADODC...

Quote:
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
Reply With Quote
  #4 (permalink)  
Old 11-27-02, 10:29
Bruce A. Baasch Bruce A. Baasch is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 11-28-02, 00:08
psatya psatya is offline
Registered User
 
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?
Reply With Quote
  #6 (permalink)  
Old 12-02-02, 13:01
psatya psatya is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On