1
Vote

Data size not been captured.

description

To add Data size data for the table structure, make the following two changes.
Within file SQLDBInfo.cs, in method public List<Column> GetColumns(string connectionString, string tableName)
  1. add the following before line with "columns.Add(column); "
                        int colsize = 0;
                        if (int.TryParse(reader["CHARACTER_MAXIMUM_LENGTH"].ToString(), out colsize ))
                        {
                            column.DataSize = colsize;
                        }
    
  2. Edit resource file DALResources.resx add , A.CHARACTER_MAXIMUM_LENGTH as below
SELECT DISTINCT A.COLUMN_NAME, A.DATA_TYPE, A.IS_NULLABLE, A.ORDINAL_POSITION,
CASE (CONSTRAINT_TYPE)
WHEN 'PRIMARY KEY' THEN 'PK'
WHEN 'FOREIGN KEY' then 'FK'
WHEN 'Both' then 'Both'
ELSE 'None'
END AS COLUMN_KEYTYPE, A.CHARACTER_MAXIMUM_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS As A
LEFT OUTER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS B
ON A.TABLE_NAME = B.TABLE_NAME AND A.COLUMN_NAME = B.COLUMN_NAME
LEFT OUTER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS C
ON C.CONSTRAINT_NAME = B.CONSTRAINT_NAME
WHERE A.TABLE_NAME = '@tableName'

comments