Discussion Locked

VB6 and ADODC Object/Controls

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am developing an application which comprises of many VB6 forms with many ADO objects/controls.
My current development server is SQLDEV. The connecting strings and recordsources for the ADO controls refer to SQLDEV. Each time I want to test the application on the production server, SQLPROD, I have to manually locate all the ADO controls on each form and reset the connecting strings and recordsources to point to SQLPROD and change them back to SQLDEV if there is an error or the application did not meet specs.
Is there an easier way of avoiding this tedious way of assigning servers to apps and controls?
Will an INI file do, if yes how?

7 replies

by bristar

How about a global variable? Change all of your server assignments to the variable name and then just change the variable assignment when needed.

by madestroitsolutions

My dear friend, simply make a system DSN by going to the control panel > administrative tools > Data Sources (ODBC). Then set the recordsets to use this ODBC connection by going to properties > [Tab] General > Use ODBC Data Source Name, and selecting the ODBC you just created... and thats it. Create this connection on both servers, and simply change the name of the server it points to, for example, create a connection called MyProgram:

- Open ODBC Data Sources in Administrative tools
- Select the System DSN TAB
- Click [Add]
- Select SQL Server Driver
- Enter "MyProgram" as the name for your connection (replace it with anything u want)
- Enter a description (optional)
- Select the SQL Server instance it connects to
- Set your login configuration
- Set startup options
- Set SQL Server settings
- Click [finish]
- Click [Test Data Source] to make sure it works

and thats it!

enjoy

any questions or comments, if you are unsure of how to do this, please, DO NOT REJECT THE ANSWER, it hurts my rating, simply e-mail me at: juanja01@optonline.net, I will be more than glad to help u out!

Good Luck!

by rrv

If you have too many controls in many forms and all in working condition (!!!) do not change logic to use global variable or DSN.

Open your forms (*.frm) using a text editor. Search and replace the connection string to your requirement. For example word editor uses Ctrl+H as search replacement shortcut.

This should definitely give you an immediate solution unless you go ahead reengineering the code with one global connection object etc.

RV

This discussion is closed to new replies.