Consulting

Results 1 to 2 of 2

Thread: .ade - When closed unexpectely prompts for SQL Login

  1. #1
    VBAX Mentor Movian's Avatar
    Joined
    Aug 2008
    Location
    NC, USA
    Posts
    399

    .ade - When closed unexpectely prompts for SQL Login

    Hey,
    so we distribute .ade files as .accdr files (Renamed so access run time doesn't have a hissy fit).

    The .accdr has instructions that load and clear the SQL connection information automatically at close and start up after reading it from the registry.

    The problem i am running into is that if the application terminates unexpectedly (end process from task manager, power cut etc etc).

    Then the connection information is not cleared and when the DB is run next it prompts for the password used in the connection information previously.

    (The code that runs on the unload of a background form)
    CurrentProject.Connection.CommandTimeout = 10
    CurrentProject.Connection.Close
    CurrentProject.OpenConnection ""
    Due to the fact that we have set up our own login form and system which we maintain, this can prevent the client from logging in or if they are smart enough to have the information it at the least becomes an annoyance as they have to login multiple times.

    We do start up the db through a launcher (That checks for updates) - Is there any way to have the launcher check for the connection info in the DB and clear it before running if its there? essentially performing the same task that the system performs on shutdown?

    The launcher is coded in C#

    So what im really looking for is some way to run the above code from C# when the database has already been closed, so it doesn't prompt when started the next time.
    Or even from a vbscript i could have the C# system run.

    As always thanks in advance!
    "From the ashes of disaster grow the roses of success" - Chitty chitty bang bang

    "I fear not the man who has 10,000 kicks practiced once. I fear the man who has 1 kick practiced 10,000 times" - Bruce Lee

  2. #2
    VBAX Mentor Movian's Avatar
    Joined
    Aug 2008
    Location
    NC, USA
    Posts
    399
    After some consideration I came up with a different angle of attack.

    The initial Connection routine as well as making the initial connection to the SQL database will generate a a file called Connected.dat (empty file simply being used as a Boolean flag). The on unload event that closes the connection will delete that same file.

    Thus if the system is shutdown in an unforeseen manor that prevents the closing of the connection it will also prevent the deletion of the file allowing us to detect the problem.

    The launcher will then check for the existence of this file and if found will delete both that file and the current .accdr file and replace it with a backup copy of the front end that is known to be good that will be stored in a sub folder and updated with the latest updates at the same time the main file is again trough the launcher.

    This should then prevent the system from asking for a login and all the user should notice is a slightly longer start up time while waiting for this process to finish.

    Its not ideal but its a workaround for now, if anyone has a better solution i would love to hear it. Just thought i would let you know what I'm working with for now.
    "From the ashes of disaster grow the roses of success" - Chitty chitty bang bang

    "I fear not the man who has 10,000 kicks practiced once. I fear the man who has 1 kick practiced 10,000 times" - Bruce Lee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •