Deploying ADO Data bound controls / changing connection string

Deploying ADO Data bound controls / changing connection string

Post by Sharon Frea » Sat, 10 Jul 1999 04:00:00



I''m writing an application that will be tested on two different SQL
servers and put into production on a third. I'm using SQL 7.0 and VB 6
Enterprise with SP3.

My problem is figuring out how to change the server name in the
connection string of my ADO data controls I use for the data source for
my data bound controls (data grids and combo boxes).

For the ADO connections I do in my code, it's no problem. I just read a
registry entry with the server name and use that in the connection
string. However, I can't figure out what to do with the data bound
controls.

I've played with this for a while now trying to put the code in
different places, however, it always seems to try to evaluate the
design-time connection string first. I tried taking out the server name
at design-time, but now I get "General network error" instead of a bad
SQL server message.

I spent the day digging through Deja and MSDN and it looks like you
might be able to use DSN or UDL for the connection string although I
only found hints of this.

Can someone point me in the right direction? Does DSN or UDL work? Can I
distribute the DSN or UDL file or create/modify it in my program? Some
of the users are coming from a UNIX menu-driven system and the rest have
no computer experience. I don't think I can get them to do any setup
work beyond clicking setup and typing the server name into the install.

If all else fails I guess I could just keep changing it and recompiling
:-(

Thanks for your help,
  Sharon

 
 
 

Deploying ADO Data bound controls / changing connection string

Post by Jesús M. NAVARR » Fri, 16 Jul 1999 04:00:00


Hi Sharon:



Quote:> I''m writing an application that will be tested on two different SQL
> servers and put into production on a third. I'm using SQL 7.0 and VB 6
> Enterprise with SP3.

> My problem is figuring out how to change the server name in the
> connection string of my ADO data controls I use for the data source for
> my data bound controls (data grids and combo boxes).

> For the ADO connections I do in my code, it's no problem. I just read a
> registry entry with the server name and use that in the connection
> string. However, I can't figure out what to do with the data bound
> controls.

> I've played with this for a while now trying to put the code in
> different places, however, it always seems to try to evaluate the
> design-time connection string first. I tried taking out the server name
> at design-time, but now I get "General network error" instead of a bad
> SQL server message.

...well, you migth try this trick: prior to compile set the connection
property to blank.
--
SALUD,
Jess
*******

*******

 
 
 

Deploying ADO Data bound controls / changing connection string

Post by Sharon Frea » Sat, 24 Jul 1999 04:00:00


Thanks Jesus. You're idea gave me a hint in the right direction.

I ended up setting the connection string and the record source properties
blank. Then in the form load I set the properties and did a refresh. Then in
the form unload I set the properties to blank.

Thanks for the help.
    Sharon Freas


> Hi Sharon:



> > I''m writing an application that will be tested on two different SQL
> > servers and put into production on a third. I'm using SQL 7.0 and VB 6
> > Enterprise with SP3.

> > My problem is figuring out how to change the server name in the
> > connection string of my ADO data controls I use for the data source for
> > my data bound controls (data grids and combo boxes).

> > For the ADO connections I do in my code, it's no problem. I just read a
> > registry entry with the server name and use that in the connection
> > string. However, I can't figure out what to do with the data bound
> > controls.

> > I've played with this for a while now trying to put the code in
> > different places, however, it always seems to try to evaluate the
> > design-time connection string first. I tried taking out the server name
> > at design-time, but now I get "General network error" instead of a bad
> > SQL server message.

> ...well, you migth try this trick: prior to compile set the connection
> property to blank.
> --
> SALUD,
> Jess
> *******

> *******

 
 
 

Deploying ADO Data bound controls / changing connection string

Post by Jesús M. NAVARR » Sun, 25 Jul 1999 04:00:00


Hi again, Sharon:



Quote:> Thanks Jesus. You're idea gave me a hint in the right direction.

> I ended up setting the connection string and the record source properties
> blank. Then in the form load I set the properties and did a refresh. Then
in
> the form unload I set the properties to blank.

> Thanks for the help.

...well, I think you don't need further help with this item: you did it:  I
usually bound visual components with datasources by code, just the way you
do: on form load (depending what I want, maybe later) setting datasource,
datamember, recordset or whatever, and setting to blank prior to unload the
form/set to nothing data components...
Still, specially working with two layer apps, it would be great not to take
care of that (more or less the same with design time/run time properties for
user/password).  Sigh
--
SALUD,
Jess
*******

*******
 
 
 

1. ADO Bound Controls & Connections Strings

Hi

When you have an ADO Data Control on a form you seem to need to set a
Connection String at Design Time that points to a valid database.  But then
if you want to have the ap run using a different database I try to set the
Connection String in say Form Load.

Q Is form load the correct place?

Problem.  If the initial design time database that is set in the properties
for the ADODC - if that database is not present then it throws an error
saying it can't find it.

Seems that the ADODC trys to set the Connection String based on the set
property before it gets to the Form_Load event.

Where/How do you set the correct ConnectionString at design time to avoid
this problem?

Thanks Peter C

2. SIGH! ADO Connection String Needed

3. Changing the ADO control connection string at run time

4. HELP NEEDED WITH SQL BASE (GUPTA)

5. Data bound controls using Adodc and ADO connection object

6. Limits In ESQL/C

7. How to bind ADO data bound controls in Visual C++

8. 0-Nationwide-104203--Project Management-Client/Server-ORACLE-PeopleSoft-Project Manager, THE GUILD

9. ADO Data Controls Connection string

10. ADO Data Control and Bound Controls

11. ADO control works while ADO Connection String fails

12. ADO Data control bind to ADO DataGrid

13. Bind an ado recordset directly to an ado data control (adodc)