var I:Integer; J:Double; procedure Insert(a:Double); begin if a <> 0 then begin showmessage( floattostr( a ) ); end; end; begin I:=10; J:=10.11; Insert( I ); Insert( J ); end;
function g_GetFieldValue(const DataSet: TDataSet; fieldName: string; var writeDB: boolean): Variant; var retValue: Variant; begin writeDB:= false; Result := Unassigned; if DataSet.State=dsInactive then Exit; retValue := DataSet[fieldName]; if retValue<>NULL then Result := retValue; writeDB := ((DataSet.FieldByName(fieldName).FieldKind=ftInteger) or (DataSet.FieldByName(fieldName).FieldKind=ftSmallint) or (DataSet.FieldByName(fieldName).FieldKind=ftFloat) or ...) and //...表示还有其他数字类型 (Result<>Unassigned); if writeDB then result := result+1; end;
再写一个从非数据集取。function g_GetNumericValue(var value: double): boolean; begin result := false; if value=0 then exit; value := value+1; result := true; end;
I:Integer;
J:Double;
procedure Insert(a:Double);
begin
if a <> 0 then
begin
showmessage( floattostr( a ) );
end;
end;
begin
I:=10;
J:=10.11;
Insert( I );
Insert( J );
end;
var
retValue: Variant;
begin
writeDB:= false;
Result := Unassigned;
if DataSet.State=dsInactive then Exit;
retValue := DataSet[fieldName];
if retValue<>NULL then Result := retValue;
writeDB := ((DataSet.FieldByName(fieldName).FieldKind=ftInteger) or
(DataSet.FieldByName(fieldName).FieldKind=ftSmallint) or
(DataSet.FieldByName(fieldName).FieldKind=ftFloat) or ...) and //...表示还有其他数字类型
(Result<>Unassigned);
if writeDB then result := result+1;
end;
begin
result := false;
if value=0 then exit;
value := value+1;
result := true;
end;
失踪的月亮
等 级:
发表于:2007-10-17 13:10:116楼 得分:0
你的需求本来也不明确,你想要怎样合适的,踏实点吧
起码要给一个库到库的答复吧,流程大家心里都有数了,一点细节都没涉及咯答案也没意义了吧