void MySql_Table_GetColumns(string TableName) { try { DataTable myDataTable_TableColumns = new DataTable(); SolutionsDBTableColumnsDAL SolutionsDBTableColumnsDAL = new SolutionsDBTableColumnsDAL(); SolutionsDBTableColumnsDAL.SolutionsDBID = this.CurrentDBID; SolutionsDBTableColumnsDAL.TableName = TableName; SolutionsDBTableColumnsDAL.TableId = 0; SolutionsDBTableColumnsDAL.isActive = true; this.TableColumns_bindingSource.DataSource = null; this.dvgTableColumns.DataSource = null; myDataTable_TableColumns = this.mySqlDBFunctions.getTablesColumns(this.mySqlDBFunctions.DatabaseName, TableName); if (myDataTable_TableColumns != null) { foreach (DataRow myRow in myDataTable_TableColumns.Rows) { SolutionsDBTableColumnsDAL.ColumnName = myRow["COLUMN_NAME"].ToString(); SolutionsDBTableColumnsDAL.ColumnType = myRow["COLUMN_TYPE"].ToString(); SolutionsDBTableColumnsDAL.COLUMN_KEY = myRow["COLUMN_KEY"].ToString(); SolutionsDBTableColumnsDAL.ColumnDataType = myRow["DATA_TYPE"].ToString(); SolutionsDBTableColumnsDAL.isIdentity = myRow["EXTRA"].ToString().ToLower().Contains("auto_increment") == true ? true : false; SolutionsDBTableColumnsDAL.DataType = SQLDataTypeConversion.getType(myRow["DATA_TYPE"].ToString()); SolutionsDBTableColumnsDAL.Insert(); } } } catch (Exception ex) { CommonClasses.Messages.GeneralError(ex.Message, " My DB SQL Connection"); } }
void GetSelectDB_TableColumns() { try { DataTable myDataTable_SolutionsDBTableColumns = new SolutionsDBTableColumnsDAL().getList_Search(10000, 1, " SolutionsDBID= " + this.cmbSolutionsDB.SelectedValue.ToString() + " and TableName like '" + this.cmbDBTables.Text + "'", "ID"); if (myDataTable_SolutionsDBTableColumns != null) { this.TableColumns_bindingSource.DataSource = myDataTable_SolutionsDBTableColumns; } this.dvgTableColumns.DataSource = this.TableColumns_bindingSource; this.dvgTableColumns.Columns["clmName"].DataPropertyName = "ColumnName"; this.dvgTableColumns.Columns["clmType"].DataPropertyName = "ColumnType"; this.dvgTableColumns.Refresh(); this.dvgTableColumns.Update(); } catch (Exception ex) { } }
void MSSql_Table_GetColumns(string TableName) { try { DataTable myDataTable_TableColumns = new DataTable(); SolutionsDBTableColumnsDAL SolutionsDBTableColumnsDAL = new SolutionsDBTableColumnsDAL(); SolutionsDBTableColumnsDAL.SolutionsDBID = this.CurrentDBID; SolutionsDBTableColumnsDAL.TableName = TableName; SolutionsDBTableColumnsDAL.TableId = 0; SolutionsDBTableColumnsDAL.isActive = true; this.TableColumns_bindingSource.DataSource = null; this.dvgTableColumns.DataSource = null; myDataTable_TableColumns = this.MsSqlDBFunctions.getTablesColumns(this.MsSqlDBFunctions.DatabaseName, TableName); if (myDataTable_TableColumns != null) { foreach (DataRow myRow in myDataTable_TableColumns.Rows) { SolutionsDBTableColumnsDAL.ColumnName = myRow["column_name"].ToString(); SolutionsDBTableColumnsDAL.ColumnType = myRow["columntype"].ToString(); SolutionsDBTableColumnsDAL.COLUMN_KEY = myRow["COLUMN_KEY"].ToString(); SolutionsDBTableColumnsDAL.ColumnDataType = myRow["DATA_TYPE"].ToString(); SolutionsDBTableColumnsDAL.isIdentity = Boolean.Parse(myRow["is_identity"].ToString()); SolutionsDBTableColumnsDAL.DataType = SQLDataTypeConversion.getType(myRow["DATA_TYPE"].ToString()); SolutionsDBTableColumnsDAL.Insert(); } } } catch (Exception ex) { CommonClasses.Messages.GeneralError(ex.Message, " My DB SQL Connection"); } }