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 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"); } }