StrataFrame Forum

How to check if no connection set in setconnections()

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

By kkchan - 1/5/2007

Hi,

How could I know if user click cancel in connection manager wizard dialog (connectionmanager.setconnections())?



Thank you
By StrataFrame Team - 1/5/2007

You can test the count of the DataSources collection after the SetConnections() method executes.

If MicroFour.StrataFrame.Data.DataBasics.DataSources.Count < 1 Then
    '-- Show some message....
End If

By kkchan - 1/5/2007

Hi,

Thank you.

How could I cancel application initialization after program detected no connection defined?
By StrataFrame Team - 1/5/2007

In VB, you can just call End.  In C#, you would need to set a flag within the Program.cs file (in some private variable that you create) and then set the e.ExitApplication property to True within the ShowGateway() method and SF will let the application fall through.
By kkchan - 1/5/2007

hi,

Thank you.

Anyway to retrieve all connection string specified in DDT? I would like to add code to check if all specified connections are valid during application startup.

By Trent L. Taylor - 1/7/2007

Anyway to retrieve all connection string specified in DDT?

I am little confused on this question.  The DDT does not store any connection strings for your run-time application.  What are you trying to accomplish here?

By kkchan - 1/7/2007

Hi,

I want to test all required connections (open the connection) during startup. If any of this connection is not available, I would display connection string wizard to ask for new connection string.
By StrataFrame Team - 1/8/2007

We have a method within our medical software that accesses a single record from the database while the splash screen is up to test the connection.  Other than attempting to access a table from the connection, I'm not sure of another way to test whether a connection string is valid.  So, wrap the access method in a try/catch and get a new connection string is an SqlException is thrown.