1。如果是用_recordset对象:
var rs:_recordset;
rs.fields.item['xxx'].value; //返回的是variant
2。如果用aodquery或adotable, 
adoquery.fieldbyname('xxx').asstring;
adoquery.fieldbyname('xxx').asfloat;
...

解决方案 »

  1.   

    我曾经做过这样的程序,提供这段代码供你研究:      for i:=0 to (adoQry_SQL.FieldCount-1) do begin
            if (not adoQry_SQL.Fields.Fields[i].IsNull) then begin
              tmpSQL1:=tmpSQL1+adoQry_SQL.Fields.Fields[i].FieldName+',';
              if (adoQry_SQL.Fields.Fields[i].ClassName='TStringField') then begin
                tmpStr:=StringReplace(adoQry_SQL.Fields.Fields[i].AsString,chr(39),'’',tmp);
                tmpSQL2:=tmpSQL2+chr(39)+tmpStr+chr(39)+',';
                updateStr:=updateStr+adoQry_SQL.Fields.Fields[i].FieldName+'='+chr(39)+tmpStr+chr(39)+',';
              end
              else if (adoQry_SQL.Fields.Fields[i].ClassName='TBCDField') then begin
                tmpSQL2:=tmpSQL2+adoQry_SQL.Fields.Fields[i].AsString+',' ;
                updateStr:=updateStr+adoQry_SQL.Fields.Fields[i].FieldName+'='+adoQry_SQL.Fields.Fields[i].AsString+',';
              end
              else if (adoQry_SQL.Fields.Fields[i].ClassName='TDateTimeField') then begin
                 tmpDate:='to_date('''+formatdatetime('YYYY-MM-DD hh:mm:ss ',adoQry_SQL.Fields.Fields[i].Asdatetime)+chr(39);
                 tmpDate:=tmpDate+','+chr(39)+'YYYY-MM-DD HH24:MI:SS'+chr(39)+'),';
                 tmpSQL2:=tmpSQL2+tmpDate;
                 updateStr:=updateStr+adoQry_SQL.Fields.Fields[i].FieldName+'='+tmpDate+',';
              end;
            end;
          end;当时我是为了动态生成insert和update 的sql语句用的,想必对这个问题也是很好的解答。
    环境:delphi5、oracle8