Connection Wizard appearing


Author
Message
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
In the sample as soon as the statement: StrataFrameApplication.RunApplication();  executes, if the connection info is not found, the connection wizard appears. The project I am working on, the client wants to suppress the wizard from appearing but bring up a form to tell the user to contact the administrator. Is there a way to intercept the logic before the connection wizard displays.

The sample I am referencing is in the program.cs in the security sample.

StrataFrameApplication.ShowLoginAndInitializeForm +=

new StrataFrameApplication.ShowLoginAndInitializeFormEventHandler(

ShowLoginAndInitMainForm);

//-- Run the application

StrataFrameApplication.RunApplication();

 


Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)StrataFrame User (195 reputation)
Group: Forum Members
Posts: 153, Visits: 462
To further clarify when the Application Run occurs the method SetDataSources() executes first and the command: ConnectionManager.SetConnections(); executes. If the connection is not found, that is when the Database Connection Wizard form appears. My question is whether I could test the result before the Connection Wizard appears and then decide whether to go ahead and display the Connection Wizard or to bring up a form informing the user that they need to contact their administrator.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
SetConnections() does not return any thing, so I don't think you can change this. I.e. SetConnections() will show the wizard if the connections aren't found in the cached connection file on the user's machine.



Which means that either they would have to use the wizard at least once OR you would have to distribute this file.



There are other ways, however. Most of the time you'll actually manage the connection yourself, using the DataLayer.DataSources() collection. This allows you lots of flexibility in how you set the connection. You might search the forum for this, as there are some excellent posts on how this can be done.



Hope that helps!
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
SetConnections just lines it all up for you.  You can just call the GetActiveConnection strings and manually set the connection. 

If ConnectionManager.GetApplicationActiveConnectionString("MyKey", "").Length > 0 Then
    '-- You have an active connection
End If

Once you have the connection string you can just manually add it to the datasources collection:

MicroFOur.StrataFrame.Data.Databasics.DataSources.Add(New SqlDbDataSourceItem("",MyConnectionString)

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