private void Button1_Click(object sender, EventArgs e)
        {
            var baseSql = $"create proc {nameTextBox.Text} (";

            foreach (DataGridViewRow row in procedureParametersDataGrid.Rows)
            {
                if (!row.IsNewRow)
                {
                    baseSql += $"@{row.Cells["ParameterName"].Value} {row.Cells["DataType"].Value},";
                }
            }

            var newSql = baseSql.Remove(baseSql.Length - 1);

            newSql += $") as {procedureDefinitionTextBox.Text}";

            var ddlViewer = new DdlViewer(baseSql);

            ddlViewer.ShowDialog();

            if (ddlViewer.DialogResult != DialogResult.OK)
            {
                return;
            }
            CurrentInformation.ConnectionProperties.Connection.Execute(baseSql);
            TreeViewConnectionBootstrapper.Init(CurrentInformation.ConnectionProperties, TreeView);
        }
Пример #2
0
        private void NewConnectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var connectionForm = new ConnectionForm();

            connectionForm.ShowDialog();

            if (connectionForm.DialogResult != DialogResult.OK)
            {
                return;
            }

            TreeViewConnectionBootstrapper.Init(CurrentInformation.ConnectionProperties, connectionsTreeView);

            connectionsTreeView.Nodes[0].Expand();
        }
Пример #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string baseSql = $"create view {nameTextBox.Text} as {sqlTextBox.Text}";


            var ddlViewer = new DdlViewer(baseSql);

            ddlViewer.ShowDialog();

            if (ddlViewer.DialogResult != DialogResult.OK)
            {
                return;
            }
            CurrentInformation.ConnectionProperties.Connection.Execute(baseSql);
            TreeViewConnectionBootstrapper.Init(CurrentInformation.ConnectionProperties, TreeView);
        }
Пример #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var baseSql = $"create table {nameTextBox.Text} (";

            foreach (DataGridViewRow row in tableDefinitionDataGrid.Rows)
            {
                if (row.IsNewRow)
                {
                    continue;
                }
                baseSql += $"{row.Cells["FieldName"].Value} {row.Cells["DataType"].Value}";
                if (row.Cells["NotNull"].Value != null && (bool)row.Cells["NotNull"].Value)
                {
                    baseSql += " NOT NULL";
                }

                if (row.Cells["PrimaryKey"].Value != null && (bool)row.Cells["PrimaryKey"].Value)
                {
                    baseSql += " PRIMARY KEY";
                }

                baseSql += ",";
            }

            baseSql += ");";

            var ddlViewer = new DdlViewer(baseSql);

            ddlViewer.ShowDialog();

            if (ddlViewer.DialogResult != DialogResult.OK)
            {
                return;
            }
            CurrentInformation.ConnectionProperties.Connection.Execute(baseSql);
            TreeViewConnectionBootstrapper.Init(CurrentInformation.ConnectionProperties, TreeView);
            tableDefinitionDataGrid.DataSource = null;
        }