示例#1
0
        private void btnTutup_Click(object sender, EventArgs e)
        {
            mod md = new mod();

            if (md.ini == false)
            {
                this.Dispose();
            }
            else
            {
                Application.Exit();
            }
        }
示例#2
0
        private void saveSetting()
        {
            if (cmbDB.EditValue == "")
            {
                MessageBox.Show("Silakan pilih database yang tersedia", "Data Transfer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                cmbDB.Focus();
            }
            else
            {
                mod md = new mod();
                md.setConString("server=" + txtServer.Text + "; port=" + txtPort.Text + "; username="******"; password="******"; database=" + cmbDB.EditValue + ";");

                if (File.Exists(Directory.GetCurrentDirectory() + "\\config.xml"))
                {
                    File.Delete(Directory.GetCurrentDirectory() + "\\config.xml");
                }

                createXML();
            }
        }
示例#3
0
        private Boolean cekKoneksi()
        {
            Boolean hasil = false;

            mod md = new mod();

            md.setConString("server=" + txtServer.Text + "; port=" + txtPort.Text + "; user id=" + txtUserName.Text + "; password="******"; database=information_schema");
            conn = md.getConn();
            sda  = md.getSda();
            comm = md.getComm();
            try
            {
                conn.Open();

                comm.Connection     = conn;
                comm.CommandText    = "select schema_name DATABASE_LIST from schemata";
                comm.CommandType    = CommandType.Text;
                comm.CommandTimeout = 1000;
                DataSet ds = new DataSet();
                sda.SelectCommand = comm;
                sda.Fill(ds);
                conn.Close();

                if (ds.Tables[0].Rows.Count > 0)
                {
                    cmbDB.Properties.DataSource    = ds.Tables[0].DefaultView;
                    cmbDB.Properties.DisplayMember = "DATABASE_LIST";
                    cmbDB.Properties.ValueMember   = "DATABASE_LIST";

                    cmbDB.Enabled = true;
                }
            }
            catch (MySqlException ex) {
                MessageBox.Show(ex.Message);
                MessageBox.Show("Koneksi gagal", "Data Transfer", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(hasil);
        }