Set a Connection object's .Connectionsource property at run time


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Set a Connection object's .Connectionsource property at run time

Hybrid View

  1. #1
    Pete Mitchell Guest

    Set a Connection object's .Connectionsource property at run time


    I would like to be able to set a connection object's .Connectionsource property
    at run time.

    At design time I create a connection object in the dataEnvironemt designer.
    It is a JET 4.0 OLE provider and this is set on the "provider" tab. I then
    set the full path and database name on the "connection" tab. This works fine.
    If you hit F4 and view the value in the Connectionsource property, it contains
    both the provider and connection info.

    I need to set this at run time because when my app gets installed somewhere
    else, the database will be in another path.
    I store the path to the database in a .ini file that gets read at run time
    but when I try setting this property directly in the main module of my app
    as well as other places, I allways get an error message. Help !!!

    Thanks

    Pete


  2. #2
    Tonny Guest

    Re: Set a Connection object's .Connectionsource property at run time


    What is the error??
    Paste your code, so we can see it

    Tonny

    "Pete Mitchell" <petemitchell@sprint.ca> wrote:
    >
    >I would like to be able to set a connection object's .Connectionsource property
    >at run time.
    >
    >At design time I create a connection object in the dataEnvironemt designer.
    >It is a JET 4.0 OLE provider and this is set on the "provider" tab. I then
    >set the full path and database name on the "connection" tab. This works

    fine.
    >If you hit F4 and view the value in the Connectionsource property, it contains
    >both the provider and connection info.
    >
    >I need to set this at run time because when my app gets installed somewhere
    >else, the database will be in another path.
    >I store the path to the database in a .ini file that gets read at run time
    >but when I try setting this property directly in the main module of my app
    >as well as other places, I allways get an error message. Help !!!
    >
    >Thanks
    >
    >Pete
    >



  3. #3
    pete Guest

    Re: Set a Connection object's .Connectionsource property at run time


    Problem Solved..

    I created a connection object in the dataEnvironemt designer.
    If you hit F4 and view the value in the
    "Connectionsource" property, it contains
    both the provider and connection info.

    I wanted to set this at run time.

    I was getting error messages because I was doing something like:
    deDataEnv1.cnConn1.connectionSOURCE = "sting of stuff"

    I need to reference the connectionSTRING prop. like this:
    deDataEnv1.cnConn1.connectionSTRING = "sting of stuff"

    Oh well, I doubt I'll make that mistake again.

    Thanks for the response..

    Pete


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center