Beispiel #1
0
        //public DataAdapterWizard() : this(new IngresDataAdapter(), null)
        //{
        //}

        public DataAdapterWizard(
            IngresDataAdapter adapter,
            System.ComponentModel.Design.IDesignerHost host)
        {
            Form dlgWelcome = new DataAdapterWizardWelcomeForm();
            DataAdapterWizardGenerateForm dlgGenerate = null;
            DialogResult result = DialogResult.OK;

            //goto debugLabel;
ShowWelcome:
            result = dlgWelcome.ShowDialog();
            if (result == DialogResult.Cancel)             // if Cancel button, return
            {
                return;
            }
            //debugLabel:
            ConnectionEditor connectionEditor =
                new ConnectionEditor(adapter, host);

            if (dlgGenerate == null)
            {
                dlgGenerate =
                    new DataAdapterWizardGenerateForm(adapter.SelectCommand);
            }

            //ShowGenerate:
            result = dlgGenerate.ShowDialog();
            if (result == DialogResult.Cancel)             // if Cancel button, return
            {
                return;
            }
            // update the SelectCommand with the entry from the form's text
            if (result == DialogResult.Retry)              // if Back button, go back one
            {
                goto ShowWelcome;
            }

            adapter.SelectCommand.CommandText = dlgGenerate.CommandText;

            try
            {
                TableMappings.Generate(adapter);
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "Could not generate DataAdapter's TableMappings.\n" +
                    ex.Message,
                    "Data Adapter Wizard");
            }
        }