HELP!!!! SQLEXPRESS and Connection Issue


Author
Message
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)
Group: Forum Members
Posts: 153, Visits: 462
I was using the 6 month trial on SQL 2008 and had to create the same database in SQL Express 2008. Both are identical with the same user ID and password to get into that database for both. When I set the default connection to SQL 2008 and start my application the log in appears instantly. When I set the default connection to SQL Express when I start the app there is a 60 second delay and then the Connect Manager appears. I simply SELECT the default connect of SQL Express and the login instantly appears. What can be going on? It is almost as though the delay is some kind of a timeout in relation to SQL EXpress that then causes the Connect Manager to appear. I am running the latest version of StrataFrame
Replies
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 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
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
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
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Ross L. Rooker, Sr. - 13 Years Ago
Edhy Rijo - 13 Years Ago
Keith Chisarik - 13 Years Ago
Ross L. Rooker, Sr. - 13 Years Ago
Ivan George Borges - 13 Years Ago
Ross L. Rooker, Sr. - 13 Years Ago
Ross L. Rooker, Sr. - 13 Years Ago
Ross L. Rooker, Sr. - 13 Years Ago
Ross L. Rooker, Sr. - 13 Years Ago
Ross L. Rooker, Sr. - 13 Years Ago
Trent L. Taylor - 13 Years Ago
Ross L. Rooker, Sr. - 13 Years Ago
Ivan George Borges - 13 Years Ago
Ross L. Rooker, Sr. - 13 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search