Force Installed Program to Ask about Connecting to Database


Author
Message
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
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.
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
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"

Edhy Rijo

Buffie
Buffie
StrataFrame User (263 reputation)StrataFrame User (263 reputation)StrataFrame User (263 reputation)StrataFrame User (263 reputation)StrataFrame User (263 reputation)StrataFrame User (263 reputation)StrataFrame User (263 reputation)StrataFrame User (263 reputation)StrataFrame User (263 reputation)
Group: StrataFrame Users
Posts: 119, Visits: 11K
Wow. Thank you so much. So fast and so helpful.....
Thanks again....
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search