Exemplo n.º 1
0
        public IEnumerable <dynamic> GetTableColumnes(string tableName)
        {
            DynamicParameters Parameters = new DynamicParameters();

            Parameters.Add("TableName", tableName);
            var sql = "SELECT SYSCOLUMNS.name as code,SYSCOLUMNS.xtype as dataType,SYSCOLUMNS.length as maxLength,SYSCOLUMNS.isnullable as isRequired FROM SYSCOLUMNS   WHERE ID=OBJECT_ID(@TableName)";
            //var sql = "SELECT SYSCOLUMNS.name as code,sysTypes.name as dataType,SYSCOLUMNS.length as maxLength,SYSCOLUMNS.isnullable as isRequired FROM SYSCOLUMNS left join sysTypes on SYSCOLUMNS.xtype=sysTypes.xtype   WHERE ID=OBJECT_ID(@TableName)";
            var ret = _dynamicRepository.Query(sql, Parameters);

            return(ret);
        }