Beispiel #1
0
        private void BtExecuteClick(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                if (File.Exists(txtOutputFolder.Text))
                {
                    string msg = string.Format("Output File Exists:  {0}\r\n\r\nDo you want to overwrite it?", txtOutputFolder.Text);
                    DialogResult dr = MessageBox.Show(msg, "File Exists", MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                    if (dr == DialogResult.No)
                    {
                        txtOutputFolder.Focus();
                        return;
                    }
                }

                var databases = new List<string>(txtDBs.Text.Trim().Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries));

                var runner = new Runner();
                runner.ExecuteQueries(txtServer.Text, txtUsername.Text, txtPassword.Text,
                                      txtScriptLocation.Text, txtOutputFolder.Text, databases,
                                      chkTrustedConnection.Checked, chkAutoFitExcelColumns.Checked, Int32.Parse(txtTimeout.Text));
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Beispiel #2
0
        public void Run()
        {
            var options = new Options();
            var parser = new CommandLineParser(new CommandLineParserSettings(Console.Error));
            if (!parser.ParseArguments(_args, options))
                Environment.Exit(1);

            var runner = new Runner();
            runner.ExecuteQueries(options.Servers, options.Username, options.Password,
                       options.InputFile, options.OutputFolder, options.SpecificDatabases,
                       options.UseTrusted, options.AutoFitColumns, options.QueryTimeout);
        }