Beispiel #1
0
        public override void ExecuteCommand(CancellationToken token)
        {
            var file = DialogManager.ShowSelectFileDialog();

            if (file == null)
            {
                return;
            }

            var ok = new Action <string>((tableName) =>
            {
                ExcelImporter importer = new ExcelImporter();
                DDLManager ddlManager  = new DDLManager();

                var meta = importer.GetMetaData(file.FullName);
                ddlManager.CreateTable(tableName, meta);
                importer.ImportToTable(file.FullName, tableName, meta);

                ShellManager.AppendToEndOfSelection("SELECT * FROM " + tableName);
                ShellManager.AppendToEndOfSelection("--DROP TABLE " + tableName);
            });


            DialogManager.GetDialogInputFromUser("Choose target table name (This table will be created)", "ExcelImport", ok);
        }