Exemple #1
0
        private void frmMenu_Load(object sender, EventArgs e)
        {
            connClass conn = new connClass();

            if (conn.testConn())
            {
                instanceClass.log.ShowDialog();
            }
            else
            {
                iMessage.iBoxOk("Terjadi kesalahan sistem." + Environment.NewLine + "Harap hubungi Adminstrator Anda.");
                Application.Exit();
            }
        }
        private void btnTes_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtServer.Text))
            {
                iMessage.eBoxOk("Silakan isi data server");
                txtServer.Focus();
            }
            else if (string.IsNullOrEmpty(txtPort.Text))
            {
                iMessage.eBoxOk("Silakan isi data port");
                txtPort.Focus();
            }
            else if (string.IsNullOrEmpty(txtUser.Text))
            {
                iMessage.eBoxOk("Silakan isi data user");
                txtUser.Focus();
            }
            else
            {
                if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    txtPassword.Text = "";
                }
                ;

                conn = new connClass(txtServer.Text, txtPort.Text, txtUser.Text, txtPassword.Text, null);
                if (conn.testConn())
                {
                    BindingSource bs = new BindingSource();
                    bs.DataSource          = conn.dbList();
                    cmbDatabase.DataSource = bs;

                    cmbDatabase.Enabled = true;
                    disableControl();
                }
                else
                {
                    iMessage.eBoxOk("Konfigurasi database salah");
                }
            }
        }