在DELPHI中如何判断该字段值为数值型还是字符型。
解决方案 »
- 发动你们的智慧,帮我一起想想以下的报文到底是何种校验!
- 菜鸟问题集,望高手指点:) 100分
- 这个问题怎么解决?
- 調查:用delphi編程後,你的月薪又是多少?未用delphi時,月薪多少?(我想學delphi,看他是否有錢途)
- 怎样用回车实现在DBGrid中向右移动,就象按Tab键一样?
- 公开几个经典的源代码,兄弟们不要告诉别人!
- 对付“欢乐时光病毒”!
- 使用XMLTransformProvider 控件的問題, 急救!!!!!!
- 在IE浏览网站时,怎样才能保存出现的Flash动画 .swf 文件?
- 如何在quickrep中把band竖立?
- 关于TComboBox
- 请高手帮忙,如何将三方控件的源码add到工程文件中??
function IsNumeric(AStr: string): Boolean;
var
Value: Double;
Code: Integer;
begin
Val(AStr, Value, Code);
result := Code = 0;
end;
{$HINTS ON}
用varisnumric()可以判断变体的是不是数字。
Variants;function VarIsNumeric(const V: Variant): Boolean;
-----------------------------------------------------------
DescriptionVarIsNumeric returns True if the given variant抯 type code indicates a numeric value of some sort. This can be either a floating-point value or an ordinal value. If the variant contains any other type of value, the function result is False.
case DataSet.Fields[I].DataType of
ftSmallint, ftInteger, ftWord, ftFloat, ftCurrency, ftBCD:
showmessage('数字型');
ftString:
showmessage('字符型');
end;