ADO Data Control = changing ConnectionString at runtime



I am using the ADO Data Control in a dialog box in an MFC-based application
that I am developing using VS2005.

This application allows the user to select the database at run-time from a
list of available databases whose structure is the same as the one that I
used in developing the application.

My problem: during development, I must set the ConnectionString property of
the ADO control to my master copy of the database on my development
computer. It is my understanding that I will be able to modify that from
within my program at run-time. My class that controls the dialog box
includes a Cadodc member variable. I plan to use the SetConnectionstring()
function of that member to change the connection string of the ADO control
at run-time.

However, when the program runs, and the user brings up that dialog box, I
receive an error from that ADO control saying that it has an invalid path.
This occurs during the Windows creation of the dialog window, and before my
Cadodc control variable has had a chance to get connected with the control,
and thus before I have had a chance to change the connection string.

I have tried setting the ADO Disabled property true at design time, but I
still get the error when the dialog box is being created at run-time.

I would appreciate any help in solving this problem.

Thanks,
Jim



.



Relevant Pages

  • Re: Navigate to Database
    ... Then you can use the connection string to create a connection, ... in case the database doesn't match the format you expect, ... control and then have my program bind to that database, ... but it could be on a different drive letter or in ...
    (microsoft.public.vsnet.general)
  • Re: Current users in database
    ... Both use ADO which I have not used much, ... given me far more control over what I have needed to date. ... As it is always in the same directory as the database and has ... Dim cn As New ADODB.Connection ...
    (microsoft.public.access.formscoding)
  • Re: ADO Data Control
    ... I think you are right, the issue is during the form load, the control ... >> If I use the ADO data control on a form and at run time I want to set ... >> the connection string (for example specify the path via code to an MS ...
    (microsoft.public.vb.database.ado)
  • Re: VB6 Winsock action on Server
    ... With the introduction on your part of ADO and DBMS. ... to be used to connect and manage data flow between client and DB? ... I think the issue is namely how to control concurrent access. ...
    (microsoft.public.vb.general.discussion)
  • Re: VB6 - Using Unbound Controls
    ... The VB6 Forms use Data Controls and ADO. ... I've developed Access Apps w/ Unbound ... Controls using DAO for almost 6 years, ... selected data from the Field data saved by the Data Control in the VB6 ...
    (microsoft.public.vb.general.discussion)