HELP!!!! SQLEXPRESS and Connection Issue


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
I did as you suggested:

Go back to your program.cs and open the SetDataSources method. Instead of calling SetConnections, manually specify the connection string just as you try and diagnose what is going on here. This way you are not relying on the ConnectionStringWizard, but have hard coded the connection string.

This still timed out as it did before and brought up the ShowConnections. Then I added Connect Timeout=100 to the connection string and then it did not timeout and the ShowConnections did not appear and the log in dialog to the app appeared as needed. The default for timeout on SQL Express is 30 which isn't always enough.

When I looked at the debug file to see what happens first shows:

Command #:  1 
Timestamp:  2012-02-08 13:27:55.427 
General Command Settings 
Command Type:  Text 
Object Type:  System.Data.SqlClient.SqlCommand 
Connection String:  server=RROOKER-HP;integrated security=SSPI;database=Auxiliary; 
Transaction:  False 
Command Settings 
CommandText:  SELECT * FROM [dbo].[SFSPreferences] 
Command Parameters 
N/A  No parameters are defined 

Then I deleted the 2 Connection files under All Users and tried as you suggested and since at that point there is no way to add a connection timeout in the Connection Wizard, it defaults back to 30 and I have the same problem. So for now I think I am stuck with overriding the connection.
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
Well, the most obvious thing to me is that you are trying to make a call to a database through a BO before you have ever set the connection string.  I will scan through all of the code that you posted, but this is a red flag:


//-- ToDo:  Configure the security settings
                //--------------------------------------------
                //-- Retrieve the global preferences
                try
                {
                    SFSPreferencesBO.RetrieveSecurityPreferences();
                }
                catch
                {
                        if (ConnectionManager.ShowAvailableConnectionStrings())
                        {
                            // Set the connections
                            ConnectionManager.SetConnections();


                            SFSPreferencesBO.RetrieveSecurityPreferences();
                        }
                }


In this code, you are placing a try/catch around attempting to retrieve the security preferences.  If you don't have your connection string set by this point, a try catch in this scenario isn't going to help and you are just going to make the end-user wait for a while as it times out.

I think that you are making this diagnosis far harder than it needs to be.  Go back to your program.cs and open the SetDataSources method.  Instead of calling SetConnections, manually specify the connection string just as you try and diagnose what is going on here.  This way you are not relying on the ConnectionStringWizard, but have hard coded the connection string.

MicroFour.StrataFrame.Data.DataBasics.DataSources.Add(new SqlDataSourceItem(string.Empty,"MyHardCodedConnectionString"));


If you aren't familiar with connection strings, here is a sample that specifies the password:

MicroFour.StrataFrame.Data.DataBasics.DataSources.Add(new SqlDataSourceItem(string.Empty,"server=MySqlServer;user=sa;password=MyPass;database=MyDatabase;"))


Here is a connection string that uses Windows authentication:

MicroFour.StrataFrame.Data.DataBasics.DataSources.Add(new SqlDataSourceItem(string.Empty,"server=MySqlServer;integrated security=SSPI;database=MyDatabase;"))


After you do this and get it working, then clear our the connections.dat again.  Then put back in the code that has the SetConnections();.  After this, if you still are not working, then turn on the debugging on the connection.  This will output an HTML file giving you all of the queries taking place and this will 100% clue you in.

MicroFour.StrataFrame.Data.DataBasics.DataSources[string.Empty].SetDebugOn(@"c:\output.html", true, true);


In the above code snippet, I like adding that last "true" as it will show a message reminding you that you have debug mode on.  It really stinks when you leave this on in a run-time environment by accident. Smile

And finally, as you have learned the hard way, I never recommend installing a trial version of anything in a production environment because it seems to expire and have issues causing down-time.  I too have learned this the hard way. Wink
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
It looks like you are getting a timeout while filling a BO, as it shows on your stack trace:

at visualOfficeNet.frmMain.tblUCompany_ParentFormLoading() in C:\visualOfficeNet\visualOfficeNet\frmMain.cs:line 525


If you would like to try to change the timeout prior to the filldatatable, you can use the CommandTimeout, increasing it or even telling it to wait forever:

        '-- Establish locals
        Dim loCommand As New SqlCommand()

        '-- Create the command
        loCommand.CommandText = "SELECT * FROM YourTable"

        '-- if you want to wait as long as it takes, set CommandTimeout to zero
        loCommand.CommandTimeout = 0

        '-- if you want to wait like 60 seconds, set CommandTimeout to 60
        loCommand.CommandTimeout = 60

        '-- Execute the command
        Me.FillDataTable(loCommand)

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
I want to try to set the timeout on the connection to see if this helps. How do you do this in the program.cs file? I think I need to increase the timeout somewhere in the framework related to: SFSPreferencesBO.RetrieveSecurityPreferences(); This may be causing my problem above.

I also have SQL Express tools loaded on the client workstation. When I tried to connect to the SQL Express database, it times out. Then if I try immediately again it connects. I noticed the default connection timeout was 30 seconds on the SQL Manager Tools login. I changed this to 60 secons and it connected the first time with no time out. So from this I am assuming there is some setting at startup of the SF Frameout that needs to be changed to allow a greater amount of time before timeout.

 


 
Edited 12 Years Ago by Ross L. Rooker, Sr.
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
On the post above when commenting out those lines, it seems that the only person that can log in and get the error is me and I am set up as the default admin. Anyone else that tries to sign on after they enter their login, there is a 20 second delay and a messagebox indicating "Connection Failed, please contact your administrator" in my CustomLogin at the AttempLogin. Again it works in the regular SQL Server 2008 Standard Edition but when I saved that DB and restored it to SQL Express this started. I detached the origin db. I deleted the connection files for strataframe and re-established the connect successfully but this still is not working. Is there anything else in the RBS or RBS database files that could be looking for the old database?

using System;
using System.Windows.Forms;

using MicroFour.StrataFrame.Messaging;
using MicroFour.StrataFrame.Security;

namespace visualOfficeNet
{
 public partial class CustomLogin : ILoginForm
 {

 #region  Private Fields

  private const string DomainValueName = "DomainValue";
  private static string _HeaderTitle = "User Authentication";
  private static string _HeaderDesc = "Please enter user credentials below.";

 #endregion

 #region  Events

  /// <summary>
  /// Occurs when the end-user attempts to authenticate.
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  /// <remarks></remarks>
  public event EventHandler AttemptLogin;

  /// <summary>
  /// Raises the AttemptLogin event.
  /// </summary>
  /// <remarks></remarks>
  protected virtual void OnAttemptLogin()
  {
   if (AttemptLogin != null)
                try
                {
                    AttemptLogin(this, EventArgs.Empty);
                }
                catch
                {
                    MessageBox.Show("Connection Failed, please contact your administrator");
                    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;

                }

  }

 #endregion

 #region  Public Properties

  /// <summary>
  /// Gets or sets a value that determines whether this form allows the application to be closed
  /// from within it.
  /// </summary>
  /// <value></value>
  /// <returns></returns>
  /// <remarks></remarks>
  public bool AllowAppExit
  {
   get
   {
    return this.cmdExit.Enabled;
   }
   set
   {
    //this.cmdExit.Enabled = value;
                this.cmdExit.Enabled = true;
   }
  }

  /// <summary>
  /// Gets or sets the domain name the end-user has entered.
  /// </summary>
  /// <value></value>
  /// <returns></returns>
  /// <remarks></remarks>
  public string DomainName
  {
   get
   {
    return this.cboDomain.Text;
   }
   set
   {
    this.cboDomain.Text = value;
   }
  }

  /// <summary>
  /// Gets or sets the gradient form header title.
  /// </summary>
  /// <value></value>
  /// <returns></returns>
  /// <remarks></remarks>
  public static string HeaderTitle
  {
   get
   {
    return _HeaderTitle;
   }
   set
   {
    _HeaderTitle = value;
   }
  }

  /// <summary>
  /// Gets or set the gradient form header description
  /// </summary>
  /// <value></value>
  /// <returns></returns>
  /// <remarks></remarks>
  public static string HeaderDesc
  {
   get
   {
    return _HeaderDesc;
   }
   set
   {
    _HeaderDesc = value;
   }
  }

  /// <summary>
  /// Gets or sets the password entered by the end-user.
  /// </summary>
  /// <value></value>
  /// <returns></returns>
  /// <remarks></remarks>
  public string Password
  {
   get
   {
    return this.txtPassword.Text;
   }
   set
   {
    this.txtPassword.Text = value;
   }
  }

  /// <summary>
  /// Gets or sets a value that indicates whether the domain combo box is shown.
  /// </summary>
  /// <value></value>
  /// <returns></returns>
  /// <remarks></remarks>
  public bool ShowDomainBox
  {
   get
   {
    return this.cboDomain.Visible;
   }
   set
   {
    this.lblDomain.Visible = value;
    this.cboDomain.Visible = value;
    //'-- Set the height of the form
    //If value Then
    //    Me.Height = 231
    //Else
    //    Me.Height = 205
    //End If
   }
  }

  /// <summary>
  /// Gets or sets the username entered by the end-user.
  /// </summary>
  /// <value></value>
  /// <returns></returns>
  /// <remarks></remarks>
  public string Username
  {
   get
   {
    return this.txtUsername.Text;
   }
   set
   {
    this.txtUsername.Text = value;
   }
  }

 #endregion

 #region  Protected Methods

  /// <summary>
  /// Overrides the OnLoad method of the base class.
  /// </summary>
  /// <param name="e"></param>
  /// <remarks></remarks>
  protected override void OnLoad(System.EventArgs e)
  {
   //-- Activate and show the form
   this.Activate();
   this.WindowState = FormWindowState.Normal;

   //-- Set the gradient form header
   this.GradientFormHeader1.Title = _HeaderTitle;
   this.GradientFormHeader1.DetailText = _HeaderDesc;

   //-- Base call
   base.OnLoad(e);
  }

 #endregion

 #region  Public Methods

  /// <summary>
  /// Sets the DialogResult of the form to DialogResult.OK.
  /// </summary>
  /// <remarks></remarks>
  public void SetDialogResultToOK()
  {
   this.DialogResult = System.Windows.Forms.DialogResult.OK;
  }

  /// <summary>
  /// Sets the delay seconds on the form.
  /// </summary>
  /// <param name="Value"></param>
  /// <remarks></remarks>
  public void SetDelaySeconds(int Value)
  {
   if (Value == 0)
   {
    grpLogin.Title = "Login Details";
   }
   else
   {
    grpLogin.Title = "Retry Delay: " + Value.ToString() + " seconds";
   }
  
        }

  /// <summary>
  /// Sets the domain names within the domain combo box to the given values.
  /// </summary>
  /// <param name="DomainNames"></param>
  /// <remarks></remarks>
  public void SetDomainNames(string[] DomainNames)
  {
   this.cboDomain.Items.Clear();
   this.cboDomain.Items.AddRange(DomainNames);

   //-- Set the text on the domain names to the old value
   this.cboDomain.Text = this.Registry.ReadString(DomainValueName, string.Empty);
  }

  /// <summary>
  /// Disable form and its controls
  /// </summary>
  /// <remarks></remarks>
  public void SetFormDisabled()
  {
   this.txtPassword.Enabled = false;
   this.txtUsername.Enabled = false;
   this.cboDomain.Enabled = false;
   this.cmdOk.Enabled = false;
  }

  /// <summary>
  /// Enable form and its controls
  /// </summary>
  /// <remarks></remarks>
  public void SetFormEnabled()
  {
   this.txtPassword.Enabled = true;
   this.txtUsername.Enabled = true;
   this.cboDomain.Enabled = true;
   this.cmdOk.Enabled = true;
  }

  /// <summary>
  /// Show the user account is deactivated.
  /// </summary>
  /// <remarks></remarks>
  public void ShowAccountDeactivated()
  {
   MessageForm.ShowMessageByKey("SFSM_UserDeactivated");
  }

  /// <summary>
  /// Shows an authentication failed message to the end-user.
  /// </summary>
  /// <remarks></remarks>
  public void ShowAuthFailedMessage()
  {
   MessageForm.ShowMessageByKey("SFSM_PasswordAuthenticationFailed");
  }

  /// <summary>
  /// Shows login attempts exceeded message.
  /// </summary>
  /// <remarks></remarks>
  public void ShowLoginAttemptsExceeded()
  {
   MessageForm.ShowMessageByKey("SFSM_LoginAttemptsExceeded");
  }

  /// <summary>
  /// Shows a message to the end-user informing them that they do not have the required permission
  /// necessary to login to the system.
  /// </summary>
  /// <remarks></remarks>
  public void ShowLoginPermissionDenied()
  {
   MessageForm.ShowMessageByKey("SFSM_LoginPermissionDenied");
  }

 #endregion

 #region  Event handlers

  /// <summary>
  /// Handles the cmdOk.Click event.
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  /// <remarks></remarks>
  private void cmdOk_Click(object sender, System.EventArgs e)
  {
   //-- Save off the selected domain text
   if (this.cboDomain.Text.Length > 0)
   {
    this.Registry.WriteValue(DomainValueName, this.cboDomain.Text);
   }

   //-- Raise the attempt login event
   this.OnAttemptLogin();
  }

  /// <summary>
  /// Handles the cmdExit.Click event.
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  /// <remarks></remarks>
  private void cmdExit_Click(object sender, System.EventArgs e)
  {
   //this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            //try
            //{
            //Application.Exit();
            Application.ExitThread();
               
            //}
            //catch
            //{

            //}

  }

 #endregion

        private void txtUsername_TextChanged(object sender, EventArgs e)
        {

        }

        private void CustomLogin_Load(object sender, EventArgs e)
        {

        }

 }
} //end of root namespace
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
After I commented out the code above, the login screen instantly appears, but then when the main form displays I get this error after about 20 seconds so it seems as though the framework is waiting for something as startup but this may give you a bit more info. If the user CANCELS the error screen, everything works but I need to get this resolved. It only happens with SQL Express.

SqlException
  Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

Source     : .Net SqlClient Data Provider

Stack Trace:
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
   at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
   at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
   at System.Data.SqlClient.TdsParserStateObject.ReadByte()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack)
   at MicroFour.StrataFrame.Data.SqlDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack)
   at MicroFour.StrataFrame.Data.DbDataSourceItem.GetDataTable(String Statement, OnChangeEventHandler CallBack)
   at MicroFour.StrataFrame.Data.DataLayer.GetDataTable(String Statement, Boolean RegisterNotification)
   at MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(String SelectStatement)
   at visualOfficeNetBO.tblUCompany.Get_UCompany() in C:\VisualOfficeNetBO\visualOfficeNetBO\visualOfficeNetBO\tblUCompany.cs:line 57
   at visualOfficeNet.frmMain.tblUCompany_ParentFormLoading() in C:\visualOfficeNet\visualOfficeNet\frmMain.cs:line 525
   at MicroFour.StrataFrame.Business.BusinessLayer.raise_ParentFormLoading()
   at MicroFour.StrataFrame.Business.BusinessLayer.OnParentFormLoading()
   at MicroFour.StrataFrame.Business.BusinessLayer.RaiseParentFormLoadingEvent()
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.InitializeFormLoadObjects()
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
   at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
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
I basically just commented out this section of code which was written a couple years ago. At this point I can't remember why it was put there.

              //-- ToDo: Configure the security settings
//--------------------------------------------
//-- Retrieve the global preferences
try
{
SFSPreferencesBO.RetrieveSecurityPreferences();
}
catch
{
if (ConnectionManager.ShowAvailableConnectionStrings())
{
// Set the connections
ConnectionManager.SetConnections();

SFSPreferencesBO.RetrieveSecurityPreferences();
}
}

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
Also, I did not delete the localization file from the Documents and Settings area which I don't believe is the issue.
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
Yes in the programs.cs there is this code: So it appears as though after I saved the database for my application from SQL 2008 Trial Edition and then restored to SQL Express 2008 that the RBS files are not being found on startup and that is why connection manager is displaying. The RBS files are located in the database with the user tables.

               //-- ToDo:  Configure the security settings
                //--------------------------------------------
                //-- Retrieve the global preferences
                try
                {
                    SFSPreferencesBO.RetrieveSecurityPreferences();
                }
                catch
                {
                        if (ConnectionManager.ShowAvailableConnectionStrings())
                        {
                            // Set the connections
                            ConnectionManager.SetConnections();


                            SFSPreferencesBO.RetrieveSecurityPreferences();
                        }
                }


Here is the entire programs.cs:

using MicroFour.StrataFrame.Application;
using MicroFour.StrataFrame.Data;
using MicroFour.StrataFrame.Security;
using MicroFour.StrataFrame.Security.BusinessObjects;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Configuration;
using System.IO;

namespace visualOfficeNet
{
    static class Program
    {
        static Boolean gotConnection = true;
       

         /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {

           
            //-- Enable visual styles on the application
            Application.EnableVisualStyles();

            //-- Add event handlers for the application events
            StrataFrameApplication.ShowGateway +=
                new StrataFrameApplication.ShowGatewayEventHandler(
                ShowGateway);
            StrataFrameApplication.InitializingApplication +=
                new StrataFrameApplication.InitializingApplicationEventHandler(
                InitApplication);
            StrataFrameApplication.SetDataSources +=
                new StrataFrameApplication.SetDataSourcesEventHandler(
                SetDataSources);
            StrataFrameApplication.UnhandledExceptionFound +=
                new StrataFrameApplication.UnhandledExceptionFoundEventHandler(
                UnhandledExceptionFound);
            StrataFrameApplication.ShowLoginAndInitializeForm +=
                new StrataFrameApplication.ShowLoginAndInitializeFormEventHandler(
                ShowLoginAndInitMainForm);

           
                //-- Run the application
                StrataFrameApplication.RunApplication();

 
                //-- Stop the session monitoring before the application exits to remove the low-level event handlers
                SessionLock.StopSessionMonitoring();

                //-- Forcibly close the application to stop message pumps from looping and preventing the application
                //   from closing
                System.Environment.Exit(1);

        }


        /// <summary>
        /// Gets the connection string if the application will use a custom method to aquire the connection
        /// string rather than the StrataFrame Connection String Manager (optional)
        /// </summary>
        /// <remarks></remarks>
        ///
        private static void SetDataSources()
        {
            
                ConnectionManager.ApplicationKey = "visualOfficeNet";
                ConnectionManager.ApplicationDefaultTitle = "visualOfficeNet";
                ConnectionManager.ApplicationDefaultDescription = "This application connection is used by visualOfficeNet";

                //-- Set the required data source information so that the ConnectionManager can gather it
                //      SQL Connection
                ConnectionManager.AddRequiredDataSourceItem("", "SQL Connection",
                    DataSourceTypeOptions.SqlServer, "visualOfficeNet_Data", "This connection is used by visualOfficeNet for the data.");

                ConnectionManager.SetConnections();
 
         }

        /// <summary>
        /// Shows the "Gateway" form (a custom form that gives the user a choice to launch different components
        /// within the application) (optional)
        /// </summary>
        /// <param name="e"></param>
        /// <remarks></remarks>
        private static void ShowGateway(ShowGatewayEventArgs e)
        {
            if (gotConnection)
            {
                //-- Inform the application to not show the "Gateway" form again after the main form has closed
                e.ShowGatewayAfterMainFormClose = false;
            }
        }

        /// <summary>
        /// Shows a login form before a main form is shown and allows security to be checked before the application
        /// launches the main form (optional)
        /// </summary>
        /// <param name="e"></param>
        /// <remarks></remarks>
        private static void ShowLoginAndInitMainForm(ShowLoginAndInitFormEventArgs e)
        {
                      //-- Set the login form to your custom login form (optional)
                    Login.LoginFormType = typeof(CustomLogin);


                    //-- Show the login form and authenticate the user

                    e.ShowMainForm = Login.ShowLoginAndAuthUser(true);
 
        }

        /// <summary>
        /// Provides a centralized location to add any initialization parameters that need to be set before
        /// the application is loaded and defines the form types used as main forms by the application
        /// </summary>
        /// <param name="e"></param>
        /// <remarks></remarks>
        private static void InitApplication(InitializingApplicationEventArgs e)
        {
            if (MicroFour.StrataFrame.Data.DataBasics.DataSources.Count < 1)
            {
                e.Forms.Clear();
                e.Forms.Add(typeof(visualOfficeNet.frmConnectionError));
                return;
            }


            //-- Add the main form type
            //-- If more than one form is added to the collection, they can be chosen by showing a "Gateway" form
            //   and supplying the index of the form to show (At least 1 form type must be added to the collection
            e.Forms.Add(typeof(visualOfficeNet.frmMain));

            //-- ToDo:  Add any extra application initialization
            MicroFour.StrataFrame.UI.Localization.MessageKeyType = MicroFour.StrataFrame.Messaging.MessageKeyDataType.XML;
            MicroFour.StrataFrame.UI.Localization.MessageLocaleID = MicroFour.StrataFrame.UI.Localization.GetActiveLanguage("visualOfficeNet", "", false); ;


 
                //-- ToDo:  Configure the security settings
                //--------------------------------------------
                //-- Retrieve the global preferences
                try
                {
                    SFSPreferencesBO.RetrieveSecurityPreferences();
                }
                catch
                {
                        if (ConnectionManager.ShowAvailableConnectionStrings())
                        {
                            // Set the connections
                            ConnectionManager.SetConnections();

                            SFSPreferencesBO.RetrieveSecurityPreferences();
                        }
                }

                //-- Set the encryption key and vector for the user data
                SecurityBasics.SetSecurityKeyAndVectorForUserAuthentication("visualOfficeNetSFSecurity");

                //-- Start the session locking monitor & set the quick key to lock the application
                SessionLock.StartSessionMonitoring();
                SessionLock.SessionLockKey = Keys.F11;

                //-- Set the administrative and security maintenance usernames and passwords
                //SecurityBasics.AdministratorUserName = "Administrator";
                //SecurityBasics.AdministratorPassword = "admin" + DateTime.Now.Day.ToString(); //-- set the admin password so that it changes from day to day
                SecurityBasics.AdministratorUserName = "rrooker";
                SecurityBasics.AdministratorPassword = "maggie5626"; //-- set the admin password so that it changes from day to day


                SecurityBasics.AdministratorUserPk = -1;

                //SecurityBasics.SecurityMaintenanceUserName = "SecurityUser";
                //SecurityBasics.SecurityMaintenancePassword = "mySecurityUserPass1";
                SecurityBasics.SecurityMaintenanceUserName = "xxxxxx";
                SecurityBasics.SecurityMaintenancePassword = "xxxxxxxxxx";

                SecurityBasics.SecurityMaintenanceUserPk = -2;

                //-- Set the default actions for security enabled objects within the application
                SecurityBasics.DefaultPermissionInfo = new PermissionInfo(PermissionAction.Deny,
                    "Access Denied.", DeniedActions.Message);
                SecurityBasics.DefaultPermissionAction = PermissionAction.Deny;
                SecurityBasics.DefaultBlockedMsg = "Access Denied.";
                //SecurityBasics.DefaultBlockedMsgKey = "AccessDeniedKey";
                SecurityBasics.BlockedReplacementCharacter = '*';
                SecurityBasics.BlockedReplacementRegex = @"[A-Za-z0-9@]";

                //-- Determine whether to allow Windows authentication
                SecurityBasics.AllowWindowsAuth = false;
            }
 

        /// <summary>
        /// Catches any unhandled exception within the application and provides a place to log the information
        /// </summary>
        /// <param name="e"></param>
        /// <remarks></remarks>
        private static void UnhandledExceptionFound(UnhandledExceptionFoundEventArgs e)
        {

        }
    }
}
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Ross L. Rooker, Sr. (2/5/2012)
... then before the login screen appears, then connection manager appears displaying the default connection. I click on it. then click SELECT, then the login screen immediately appears and everything works fast at this point.

Are you calling ConnectionManager.ShowAvailableConnectionStrings() somewhere for some reason?
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