Example #1
0
        private void ValidateQuerybutton_Click(object sender, EventArgs e)
        {
            object dt;

            ds = DMEEditor.GetDataSource(dataSourceIDComboBox.Text);
            if (SourceConnection != null && EntityStructure.CustomBuildQuery != null)
            {
                dt = SourceConnection.RunQuery(EntityStructure.CustomBuildQuery);
            }
            else
            {
                dt = SourceConnection.GetEntity(EntityName, null);
            }
            CustomQueryDatadataGridView.DataSource = dt;
        }
        private void ValidateQuerybutton_Click(object sender, EventArgs e)
        {
            // ds = (DataViewDataSource)DMEEditor.GetDataSource(dataSourceIDComboBox.Text);

            object dt;

            if (!string.IsNullOrEmpty(EntityStructure.CustomBuildQuery) && !string.IsNullOrWhiteSpace(EntityStructure.CustomBuildQuery))
            {
                SourceConnection = DMEEditor.GetDataSource(dataSourceIDComboBox.Text);
                if (SourceConnection.Category != DatasourceCategory.VIEWS)
                {
                    if (SourceConnection != null && EntityStructure.CustomBuildQuery != null)
                    {
                        dt = SourceConnection.RunQuery(EntityStructure.CustomBuildQuery);
                    }
                    else
                    {
                        dt = SourceConnection.GetEntity(EntityName, null);
                    }
                    if (dt != null)
                    {
                        EntityStructure.Fields = DMEEditor.Utilfunction.GetFieldFromGeneratedObject(dt);
                        this.dataHierarchyBindingSource.ResetBindings(true);
                        this.fieldsBindingSource.ResetBindings(true);
                        fieldsBindingSource.DataSource = dataHierarchyBindingSource;
                        fieldsDataGridView.Refresh();
                        CustomQueryDatadataGridView.DataSource = dt;
                    }
                }
                else
                {
                    MessageBox.Show("Cannot Run Query on DataView");
                }
            }
            else
            {
                MessageBox.Show("Query Missing");
            }
        }