我能想到的是:后台存储过程对每个字段“格式化”后输出,可是字段很多,写起来太烦了。
解决方案 »
- 如何用delphi执行一段机器码指令?
- 请问一个Form的按钮事件中,如何写代码显示同一个Form,当然显示的Form的记录不同(里面有AdoQuery组件)
- 小弟没学过dephi 相知道他与vc的区别
- 一个有关将圆等分成360份的问题!
- DBGrid的字段有很多,怎么把他们分成两行显示?
- Indy 中IdTCPServer,IdTCPClient.. 为什么客户端关机了..服务端的CONNECTED还是为TRUE?有这么多分<110+ 120>
- 急!
- 怎么在delphi中调用象配置ADO组件中的connectstring的那个界面(?.exe)
- 在SQL—SERVER中的存储过程怎样进行异常保护呢
- DAX错误
- 串口通信流控制问题
- 两 个DBComboBoxEh 怎么实现 两级下拉
if (Sender as TDBGrid).DataSource.DataSet.FieldByName('CustNo').AsString = '' then
TextOut(Rect.Left+2,Rect.Top+3,'无');
function ChangeZeroToSpace(Sender: TDBGrid): Boolean;
var
RowCount, ColCount: integer;
RowCycle, ColCycle: integer;
begin
ColCount := TStringGrid(Sender).ColCount;
RowCount := TStringGrid(Sender).RowCount;
for RowCycle := 0 to RowCount do
for ColCycle := 0 to ColCount do
begin
if TStringGrid(Sender).Cells[ColCycle, RowCycle] = '零' then
TStringGrid(Sender).Cells[ColCycle, RowCycle] := '空'
end;
end;注: 要引用单元: Grids
function ChangeZeroToSpace(Sender: TDBGrid): Boolean;
var
RowCount, ColCount: integer;
RowCycle, ColCycle: integer;
begin
Result := False;
ColCount := TStringGrid(Sender).ColCount;
RowCount := TStringGrid(Sender).RowCount;
for RowCycle := 0 to RowCount do
for ColCycle := 0 to ColCount do
begin
if TStringGrid(Sender).Cells[ColCycle, RowCycle] = '零' then
TStringGrid(Sender).Cells[ColCycle, RowCycle] := '空'
end;
Result := True;
end; 注: 要引用单元: Grids
hege3344520 的方法简单地说就是遍历所有的单元格,效率太低。
两个方法都不能采用。期待其他答案。
你应该写一个公共的GetText过程,处理字段为null的情况,然后动态将字段的OnGetText指向你的公共GetText事件