This class customize standard connection properties for MySql data base connection.
Inheritance: AdoDotNetConnectionProperties
        /// <summary>
        /// Extract connection options in this handler.
        /// </summary>
        /// <param name="e">Not used</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Check connection support
            if (ConnectionSupport == null)
            {
                Debug.Fail("No connection support!");
                return;
            }

            // Create connection properties to parse connection string
            MySqlConnectionProperties prop = new MySqlConnectionProperties();
            prop.ConnectionStringBuilder.ConnectionString = ConnectionSupport.ConnectionString;

            // Extract server name and port to build connection string
            string server = prop["Server"] as string;
            if (String.IsNullOrEmpty(server))
                server = "localhost"; // Empty server name means local host
            Int64 port = 3306; // By default port is 3306
            object givenPort = prop["Port"];
            if (givenPort != null && typeof(Int64).IsAssignableFrom(givenPort.GetType()))
                port = (Int64)givenPort;

            // Format caption
            Text = String.Format(CultureInfo.CurrentCulture, Text, server, port);

            // Extract options
            login.Text = prop["User Id"] as string;
            password.Text = prop["Password"] as string;
            if (prop["Persist Security Info"] is bool)
                savePassword.Checked = (bool) prop["Persist Security Info"];
            else
                savePassword.Checked = false;
        }
        /// <summary>
        /// Extract connection options in this handler.
        /// </summary>
        /// <param name="e">Not used</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Check connection support
            if (ConnectionSupport == null)
            {
                Debug.Fail("No connection support!");
                return;
            }

            // Create connection properties to parse connection string
            MySqlConnectionProperties prop = new MySqlConnectionProperties();
            prop.ConnectionStringBuilder.ConnectionString = ConnectionSupport.ConnectionString;

            // Extract server name and port to build connection string
            string server = prop[MySqlConnectionProperties.Names.Server] as string;
            if (String.IsNullOrEmpty(server))
                server = "localhost"; // Empty server name means local host
            Int64 port = 3306; // By default port is 3306
            if (DataInterpreter.IsInteger(prop[MySqlConnectionProperties.Names.Port]))
                port = (Int64) prop[MySqlConnectionProperties.Names.Port];

            // Format caption
            Text = String.Format(CultureInfo.CurrentCulture, Text, server, port);

            // Extract options
            login.Text = prop[MySqlConnectionProperties.Names.UserID] as string;
            password.Text = prop[MySqlConnectionProperties.Names.Password] as string;
            if (prop[MySqlConnectionProperties.Names.PersistSecurityInfo] is bool)
                savePassword.Checked = (bool) prop[MySqlConnectionProperties.Names.PersistSecurityInfo];
            else
                savePassword.Checked = false;
        }
        /// <summary>
        /// Extract connection options in this handler.
        /// </summary>
        /// <param name="e">Not used</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Check connection support
            if (ConnectionSupport == null)
            {
                Debug.Fail("No connection support!");
                return;
            }

            // Create connection properties to parse connection string
            MySqlConnectionProperties prop = new MySqlConnectionProperties();

            prop.ConnectionStringBuilder.ConnectionString = ConnectionSupport.ConnectionString;

            // Extract server name and port to build connection string
            string server = prop["Server"] as string;

            if (String.IsNullOrEmpty(server))
            {
                server = "localhost"; // Empty server name means local host
            }
            Int64  port      = 3306;  // By default port is 3306
            object givenPort = prop["Port"];

            if (givenPort != null && typeof(Int64).IsAssignableFrom(givenPort.GetType()))
            {
                port = (Int64)givenPort;
            }

            // Format caption
            Text = String.Format(CultureInfo.CurrentCulture, Text, server, port);

            // Extract options
            login.Text    = prop["User Id"] as string;
            password.Text = prop["Password"] as string;
            if (prop["Persist Security Info"] is bool)
            {
                savePassword.Checked = (bool)prop["Persist Security Info"];
            }
            else
            {
                savePassword.Checked = false;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Extract connection options in this handler.
        /// </summary>
        /// <param name="e">Not used</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Check connection support
            if (ConnectionSupport == null)
            {
                Debug.Fail("No connection support!");
                return;
            }

            // Create connection properties to parse connection string
            MySqlConnectionProperties prop = new MySqlConnectionProperties();

            prop.ConnectionStringBuilder.ConnectionString = ConnectionSupport.ConnectionString;

            // Extract server name and port to build connection string
            string server = prop[MySqlConnectionProperties.Names.Server] as string;

            if (String.IsNullOrEmpty(server))
            {
                server = "localhost"; // Empty server name means local host
            }
            Int64 port = 3306;        // By default port is 3306

            if (DataInterpreter.IsInteger(prop[MySqlConnectionProperties.Names.Port]))
            {
                port = (Int64)prop[MySqlConnectionProperties.Names.Port];
            }

            // Format caption
            Text = String.Format(CultureInfo.CurrentCulture, Text, server, port);

            // Extract options
            login.Text    = prop[MySqlConnectionProperties.Names.UserID] as string;
            password.Text = prop[MySqlConnectionProperties.Names.Password] as string;
            if (prop[MySqlConnectionProperties.Names.PersistSecurityInfo] is bool)
            {
                savePassword.Checked = (bool)prop[MySqlConnectionProperties.Names.PersistSecurityInfo];
            }
            else
            {
                savePassword.Checked = false;
            }
        }
Beispiel #5
0
        /// <summary>
        /// Creates new connection string depending on user inpur.
        /// </summary>
        /// <param name="sender">Not used.</param>
        /// <param name="e">Not used.</param>
        private void OkClick(object sender, EventArgs e)
        {
            // Check connection support
            if (ConnectionSupport == null)
            {
                Debug.Fail("No connection support!");
                return;
            }

            // Create connection properties to parse connection string
            MySqlConnectionProperties prop = new MySqlConnectionProperties();

            prop.ConnectionStringBuilder.ConnectionString = ConnectionSupport.ConnectionString;

            // Apply changed options
            prop[MySqlConnectionProperties.Names.UserID]              = login.Text;
            prop[MySqlConnectionProperties.Names.Password]            = password.Text;
            prop[MySqlConnectionProperties.Names.PersistSecurityInfo] = savePassword.Checked;

            // Change connection string for connection support
            ConnectionSupport.ConnectionString = prop.ToFullString();
        }
        /// <summary>
        /// Creates new connection string depending on user inpur.
        /// </summary>
        /// <param name="sender">Not used.</param>
        /// <param name="e">Not used.</param>
        private void OkClick(object sender, EventArgs e)
        {
            // Check connection support
            if (ConnectionSupport == null)
            {
                Debug.Fail("No connection support!");
                return;
            }

            // Create connection properties to parse connection string
            MySqlConnectionProperties prop = new MySqlConnectionProperties();
            prop.ConnectionStringBuilder.ConnectionString = ConnectionSupport.ConnectionString;

            // Apply changed options
            prop["User Id"] = login.Text;
            prop["Password"] = password.Text;
            prop["Persist Security Info"] = savePassword.Checked;

            // Change connection string for connection support
            ConnectionSupport.ConnectionString = prop.ToFullString();
        }