Ejemplo n.º 1
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            TstServerName = txtServerHost.Text;
            TstPortName   = txtPort.Text;
            TstUserName   = txtUserName.Text;
            TstPwd        = txtPassword.Text;
            TstDBName     = txtDatabase.Text;

            try
            {
                SQLConn.conn.ConnectionString = "Server = '" + TstServerName + "';  " + "Port = '" + TstPortName + "'; " + "Database = '" + TstDBName + "'; " + "user id = '" + TstUserName + "'; " + "password = '******'";
                SQLConn.conn.Open();

                SQLConn.DBName     = txtDatabase.Text;
                SQLConn.ServerName = txtServerHost.Text;
                SQLConn.UserName   = txtUserName.Text;
                SQLConn.PortName   = txtPort.Text;
                SQLConn.Pwd        = txtPassword.Text;

                SQLConn.SaveData();
                this.Close();
            }
            catch
            {
                MessageBox.Show("The system failed to establish a connection", "Database Settings", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            SQLConn.DisconnMy();
            //save database
        }