StrataFrame Forum

Force Installed Program to Ask about Connecting to Database

http://forum.strataframe.net/Topic32841.aspx

By Terry Bottorff - 1/26/2015

I have an a program that I installed on a machine and I want to force it to go thru the ConnectionManager. Is there a way to do that?
I need the program to attach to a new database but because it has been installed before it continues to connect to the old database. 
Is that info stored somewhere that I can change it on the client machine?
I tried  changing the applicationKey in the Appmain but and then recreating the setup but that did not seem to work?

TIA.
By Edhy Rijo - 1/26/2015

Hi Terry,

That information is stored in the Connections.dat and AppKeys.dat which are stored in the "%ProgramData%\MicroFour\ConnectionData folder of your computer.

You have several options here:
  1. Delete those files and then your application will show up the Connection Manager to allow you to enter another connection.
  2. Create a utility program that will allow you to access the Connection Manager in which you can edit your connection and select the current one you want to use.
If yo go with 2nd option, here is a method I use to change and set any connection as the default one for my applications:


''' <summary>
''' Sets the database connection
''' </summary>
''' <remarks></remarks>
Private Sub SetDatabaseConnection()
    '-- Check security for this module
    If Not Progytech.Helpers.HasPermission("Database Connection"Then
         Exit Sub
    End If

     '-- Show the connection dialog and allow a connection to be selected
    If MicroFour.StrataFrame.Data.ConnectionManager.ShowAvailableConnectionStrings() Then
        '-- Since a connection was selected, then all of the existing dialogs need to be closed
        '   since their connection is established to the original source.
        For Each loForm As Form In Me.MdiChildren
            loForm.Close()
            loForm.Dispose()
        Next
        '-- Force the connections to be reset
        MicroFour.StrataFrame.Data.ConnectionManager.SetConnections()

    End If
End Sub

The %ProgramData% enviornment variable should translate to your computer location of "C:\ProgramData\MicroFour\ConnectionData"
By Buffie - 1/26/2015

Wow. Thank you so much. So fast and so helpful.....
Thanks again....