public void GetStoredProcedureList(bool isIncludeDefaultSP) { List <String> lstSPs = new List <string>(); foreach (String strTableName in DataStructureProvider.DataTablesList.Keys) { lstSPs.AddRange(StoredProcedureGenerator.GetSPNameList(strTableName)); } DataSet ds = DataQueryProvider.RunQuery("SELECT name FROM sys.procedures;"); if (ds != null && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0].Clone(); foreach (DataRow dr in ds.Tables[0].Rows) { String strName = dr["name"].ToString(); if (isIncludeDefaultSP || lstSPs.Contains(strName) == false) { dt.ImportRow(dr); } } GridCtrl.DataSource = dt; } }
public void ExecuteScript( ) { String stQuery = SourceSQLEditor.Selection.Text.Trim(); if (String.IsNullOrWhiteSpace(stQuery)) { stQuery = SourceSQLEditor.Text; } if (String.IsNullOrWhiteSpace(stQuery)) { return; } ABCHelper.ABCWaitingDialog.Show("", "Executing . . .!"); DataSet ds = DataQueryProvider.RunQuery(stQuery); if (ds != null && ds.Tables.Count > 0) { gridControl1.DataSource = ds.Tables[0]; gridView1.PopulateColumns(); gridControl1.RefreshDataSource(); gridView1.BestFitColumns(); } ABCHelper.ABCWaitingDialog.Close(); }
public void ExecuteScript( ) { if (ScriptTabControl.SelectedTabPage == null) { return; } Scintilla rtbScript = (Scintilla)ScriptTabControl.SelectedTabPage.Controls[0]; String stQuery = rtbScript.Selection.Text.Trim(); if (String.IsNullOrEmpty(stQuery)) { stQuery = rtbScript.Text; } if (String.IsNullOrEmpty(stQuery)) { return; } Cursor.Current = Cursors.WaitCursor; DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm(); waiting.SetCaption("Executing . . .!"); waiting.Show(); DataSet ds = DataQueryProvider.RunQuery(stQuery); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1) { ResultRichText.Text = ds.Tables[0].Rows[0][0].ToString(); } waiting.Close(); Cursor.Current = Cursors.Default; }
public void RefreshDisplayTree( ) { DisplayTreeListCtrl.TableName = this.TableName; DisplayTreeListCtrl.InnerTreeList.Columns.Clear(); DisplayTreeListCtrl.ColumnConfigs = this.ColumnList; DisplayTreeListCtrl.Manager.ConfigList = this.Manager.ConfigList;//new DisplayTreeListCtrl.InitColumns(); #region Script if (String.IsNullOrWhiteSpace(this.TableName)) { if (String.IsNullOrWhiteSpace(Script) == false) { DataSet ds = DataQueryProvider.RunQuery(Script); if (ds != null && ds.Tables.Count > 0) { Manager.Invalidate(ds); DisplayTreeListCtrl.InnerTreeList.ColumnsCustomization(); } } return; } #endregion if (DataCachingProvider.LookupTables.ContainsKey(this.TableName)) { Manager.Invalidate(DataCachingProvider.LookupTables[this.TableName]); } else { ABCHelper.ConditionBuilder strBuilder = new ABCHelper.ConditionBuilder(); strBuilder.Append(String.Format(@"SELECT TOP 5 * FROM {0} ", this.TableName)); if (DataStructureProvider.IsExistABCStatus(this.TableName)) { strBuilder.AddCondition(QueryGenerator.GenerateCondition(this.TableName, ABCCommon.ABCColumnType.ABCStatus)); } strBuilder.Append(String.Format(@" ORDER BY {0} DESC", DataStructureProvider.GetPrimaryKeyColumn(this.TableName))); try { DataSet ds = DataQueryProvider.RunQuery(strBuilder.ToString()); if (ds != null && ds.Tables.Count > 0) { this.DisplayTreeListCtrl.InnerTreeList.DataSource = ds.Tables[0]; } } catch (Exception ex) { } } this.DisplayTreeListCtrl.InnerTreeList.RefreshDataSource(); DisplayTreeListCtrl.InnerTreeList.ColumnsCustomization(); }
public static object GetData(String strQuery) { DataSet ds = DataQueryProvider.RunQuery(strQuery); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { return(ds.Tables[0].Rows[0][0]); } return(null); }
public void DeleteSP( ) { String strSPName = GridView.GetRowCellDisplayText(GridView.FocusedRowHandle, "name"); if (String.IsNullOrEmpty(strSPName) == false) { DialogResult result = DevExpress.XtraEditors.XtraMessageBox.Show(String.Format("Do you want to delete SP : [{0}] ? ", strSPName), "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes) { DataQueryProvider.RunQuery(String.Format("DROP PROCEDURE [{0}] ", strSPName)); GetStoredProcedureList(chkShowDefaultSP.Checked); } } }
public void RefreshDisplayGrid( ) { DisplayGridCtrl.TableName = this.TableName; DisplayGridCtrl.Grid.Fields.Clear(); DisplayGridCtrl.FieldConfigs = this.FieldsList; DisplayGridCtrl.InitFields(); DisplayGridCtrl.Grid.OptionsView.RowTreeWidth = RowTreeWidth; DisplayGridCtrl.UseChartControl = UseChartControl; DisplayGridCtrl.Script = Script; if (String.IsNullOrWhiteSpace(this.TableName)) { DisplayGridCtrl.LoadDataSourceFromScript(); return; } if (DataCachingProvider.LookupTables.ContainsKey(this.TableName)) { this.DisplayGridCtrl.GridDataSource = DataCachingProvider.LookupTables[this.TableName]; } else { ABCHelper.ConditionBuilder strBuilder = new ABCHelper.ConditionBuilder(); strBuilder.Append(String.Format(@"SELECT TOP 5 * FROM {0}", this.TableName)); if (DataStructureProvider.IsExistABCStatus(this.TableName)) { strBuilder.AddCondition(QueryGenerator.GenerateCondition(this.TableName, ABCCommon.ABCColumnType.ABCStatus)); } strBuilder.Append(String.Format(@" ORDER BY {0} DESC", DataStructureProvider.GetPrimaryKeyColumn(this.TableName))); try { DataSet ds = DataQueryProvider.RunQuery(strBuilder.ToString()); if (ds != null && ds.Tables.Count > 0) { this.DisplayGridCtrl.GridDataSource = ds.Tables[0]; } } catch (Exception ex) { } } this.DisplayGridCtrl.RefreshDataSource(); DisplayGridCtrl.Grid.FieldsCustomization(splitContainerControl2.Panel2); }
public void ShowStoredProcedure(String strSPname) { Scintilla richText = AddNewTab(); DataSet ds = DataQueryProvider.RunQuery(String.Format("sp_helptext [{0}];", strSPname)); if (ds != null && ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { richText.Text += dr[0].ToString(); } } richText.Text = richText.Text.Replace("CREATE PROCEDURE", "ALTER PROCEDURE"); }
public static List <object> GetListObjects(String strQuery) { List <object> lstResults = new List <object>(); DataSet ds = DataQueryProvider.RunQuery(strQuery); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { if (dr[0] != null && dr[0] != DBNull.Value) { lstResults.Add(dr[0]); } } } return(lstResults); }
public void RefreshDisplayGrid( ) { DisplayGridView.TableName = this.TableName; DisplayGridView.Columns.Clear(); DisplayGridView.Bands.Clear(); DisplayGridView.BandConfigs = this.BandsList; DisplayGridView.ColumnConfigs = this.ColumnList; DisplayGridView.LoadBands(); #region Script if (String.IsNullOrWhiteSpace(this.TableName)) { if (String.IsNullOrWhiteSpace(Script) == false) { DataSet ds = DataQueryProvider.RunQuery(Script); if (ds != null && ds.Tables.Count > 0) { this.DisplayGridCtrl.DataSource = ds.Tables[0]; this.DisplayGridCtrl.RefreshDataSource(); DisplayGridView.ShowCustomization(); } } return; } #endregion if (DataCachingProvider.LookupTables.ContainsKey(this.TableName)) { this.DisplayGridCtrl.DataSource = DataCachingProvider.LookupTables[this.TableName]; } else { ABCHelper.ConditionBuilder strBuilder = new ABCHelper.ConditionBuilder(); strBuilder.Append(String.Format(@"SELECT TOP 5 * FROM {0}", this.TableName)); if (DataStructureProvider.IsExistABCStatus(this.TableName)) { strBuilder.AddCondition(QueryGenerator.GenerateCondition(this.TableName, ABCCommon.ABCColumnType.ABCStatus)); } strBuilder.Append(String.Format(@" ORDER BY {0} DESC", DataStructureProvider.GetPrimaryKeyColumn(this.TableName))); try { DataSet ds = DataQueryProvider.RunQuery(strBuilder.ToString()); if (ds != null && ds.Tables.Count > 0) { this.DisplayGridCtrl.DataSource = ds.Tables[0]; } } catch (Exception ex) { } } this.DisplayGridCtrl.RefreshDataSource(); if (DisplayGridView.CustomizationForm == null || DisplayGridView.CustomizationForm.Visible == false) { DisplayGridView.ShowCustomization(); } }
public static DataSet RunQuery(String strQuery) { return(DataQueryProvider.RunQuery(strQuery)); }