public void OnShowCode(string key) { m_ShowKey = key; if (this.tableId < 1) { return; } if (m_ShowKey == "tableinfo") { DataRowView tableView = DataMarket.GetTableInfo(this.tableId); TableExpandDT table = new TableExpandDT(tableView); if (table.TableType.Trim().ToLower() == "v" || table.TableType.Trim().ToLower() == "p") { DBInfo(); return; } } CodeObject obj = Template.s_CodeObjects[key]; if (obj != null) { this.SetInputText(obj.GetCode(this.tableId)); } }
private void GetCode() { DataRowView tableView = DataMarket.GetTableInfo(this.tableId); if (tableView == null) { return; } TableExpandDT table = new TableExpandDT(tableView); tableName = table.TableName; string sql = "select top 100 * from [{0}] {1}"; List <PKDT> pks = table.PKs; string order = table.GetOrderStr(); sql = string.Format(sql, table.TableName, order); //CodeObject obj = Template.s_CodeObjects["tableinfo"]; this.txtInputArea.Text = sql; this.dgList.DataSource = null; // this.txtDisplayArea.Text += this.txtInputArea.Text; //this.txtInputArea. ControlUtils.SetSQLColor(this.txtInputArea); }
/// <summary> /// 生成TemplateDT对象。 /// </summary> /// <param name="tableId"></param> /// <returns></returns> public static TemplateDT CreateTemplateDT(int tableId) { DataRowView tableView = DataMarket.GetTableInfo(tableId); TableExpandDT table = new TableExpandDT(tableView); return(new TemplateDT(table)); }
public void SetTableID(int id) { this.tableId = id; if (this.tableId > 0) { // 设置数据库表列显示信息 DataRowView tableView = DataMarket.GetTableInfo(this.tableId); if (tableView == null) { return; } TableExpandDT table = new TableExpandDT(tableView); this.dgvColumns.AutoGenerateColumns = false; this.dgvColumns.DataSource = table.Columns; } else { this.dgvColumns.DataSource = null; } }