Exemple #1
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtDbName.Text))
            {
                txtDbName.Text      = "Remplissez ce champ!";
                txtDbName.ForeColor = Color.Red;
                return;
            }
            if (String.IsNullOrEmpty(txtServer.Text))
            {
                txtServer.Text      = "Remplissez ce champ!";
                txtServer.ForeColor = Color.Red;
                return;
            }

            if (String.IsNullOrEmpty(txtUser.Text))
            {
                txtUser.Text      = "Remplissez ce champ!";
                txtUser.ForeColor = Color.Red;
                return;
            }

            if (String.IsNullOrEmpty(txtPwd.Text))
            {
                txtPwd.Text      = "Remplissez ce champ!";
                txtPwd.ForeColor = Color.Red;
                return;
            }

            DatabaseManager dm = new DatabaseManager();
            DataSettings    ds = new DataSettings();

            ds.BuildConnectionString(txtServer.Text, txtDbName.Text, txtUser.Text, txtPwd.Text);

            bool success = TestConnection(ds);

            if (!success)
            {
                lblError.Text = "Invalid database";
                return;
            }
            try
            {
                dm.SaveSettings(ds);
            }catch (Exception ex)
            {
                Program.log(ex);
            }

            Install i = new Install();

            i.Show();
            this.Hide();
        }