Esempio n. 1
0
        private void btExportScripts_Click(object sender, EventArgs e)
        {
            ExportScripts es = new ExportScripts();

            try
            {
                string[] dbs = tbDatabases.Text.Replace("\r", "").Split('\n').Select(db => db.Trim()).Where(db => db != "").ToArray();

                es.dbprovider = cbProvider.SelectedValue.ToString();
                es.dbserver = cbServer.Text;
                es.databases = dbs;
                es.path = tbOutputPathScripts.Text;
                es.writemodified = cbWriteModified.Checked;

                if (cbSQLLogin.Checked)
                {
                    es.dbusername = tbUsername.Text;
                    es.dbpassword = tbPassword.Text;
                }
                else
                {
                    es.dbusername = null;
                    es.dbpassword = null;
                }

                es.Export();

                this.Text = es._result;
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(
                                "DB: " + es._dbname + "\n" +
                                "SQL: " + es._sql + "\n" +
                                ex.ToString());
            }
        }
Esempio n. 2
0
        private void btExportScripts_Click(object sender, EventArgs e)
        {
            ExportScripts es = new ExportScripts();

            try
            {
                string[] dbs = tbDatabases.Text.Replace("\r", "").Split('\n').Select(db => db.Trim()).Where(db => db != "").ToArray();

                es.dbprovider    = cbProvider.SelectedValue.ToString();
                es.dbserver      = cbServer.Text;
                es.databases     = dbs;
                es.path          = tbOutputPathScripts.Text;
                es.writemodified = cbWriteModified.Checked;

                if (cbSQLLogin.Checked)
                {
                    es.dbusername = tbUsername.Text;
                    es.dbpassword = tbPassword.Text;
                }
                else
                {
                    es.dbusername = null;
                    es.dbpassword = null;
                }

                es.Export();

                this.Text = es._result;
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(
                    "DB: " + es._dbname + "\n" +
                    "SQL: " + es._sql + "\n" +
                    ex.ToString());
            }
        }