Changing Connection String

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have a ado Data Control on my form. I want to set the connection string on
form load.
So my database is players.mdb. So I set the string in the design properties
to C:\Test\Players.mdb
When the form loads, I want to change it to a new location. Say
C:\MyApp\Players.mdb
However, when the form loads, I get an error message "Cannot find
C:\Test\Players.mdb", which happens before I can set the new correct
connection string. Any ideas? If I leave the connection string blank in the
properties, I get an error of "data source name not found and no default
database specified" Any idea?
Thanks
Diarmuid


.



Relevant Pages

  • Re: Cannot display ODBC login prompt - want to connect without DSN
    ... database without knowing anything beforehand except the driver name. ... need a connection string and different data sources use different connection ... ODBC, ADO, and VB Script. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Cannot display ODBC login prompt - want to connect without DSN
    ... Depending on the database you are using, ... you need to know the basics of the connection string and can populate ... no. the login box which you are talking about was provided to ODBC ... When the user exits the dialog box, the driver connects ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Change Connection String at runtime.
    ... easily moved to another database, or have versions for each database. ... connection string to the connectionobject before the connection opens. ... *The Server IP number is different for every deployment. ... It appears that the generated code uses the application settings to ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Cannot display ODBC login prompt - want to connect without DSN
    ... Depending on the database you are using, ... database without knowing anything beforehand except the driver name. ... you need to know the basics of the connection string and can populate ... no. the login box which you are talking about was provided to ODBC ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Change Connection String at runtime.
    ... exposes custom objects that are implemented to use the custom data access ... easily moved to another database, or have versions for each database. ... and protocols each data source exposes. ... connection string to the connectionobject before the connection opens. ...
    (microsoft.public.dotnet.framework.adonet)