简体   繁体   中英

Use rpad in delphi grid

Use rpad in tdbgrid not working correctly. In sql devleper work fine. Any solution for this problem.

Select rpad('Lionel Messi',20,'.') as COL_1 from dual
union all
Select rpad('Cristiano Ronaldo',20,'.') as COL_1 from dual
union all
Select rpad('Pele',20,'.') as COL_1 from dual

Example:

在此处输入图像描述

Looks like your Sql developer is using a fixed-pitch font, whereas your DBGrid isn't. Set your DBGrid to use a fixed-pitch font like Courier New.

In any case, for future reference, it is not very sound practice to use SQL on your SQL Server to do output formatting by using eg RPad(), especially when it is applied to every single row of a result set - it pointlessly consumes server resources and network bandwidth for something that should be left to the client to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM