procedure TForm2.Button1Click(Sender: TObject); begin Edit2.Text:= Table1.fieldbyname(Edit1.Text).ClassName; end;
到底如何具体如何判断呢? 比如说IF Table1.fieldbyname(Edit1.Text)=XX THEN 如何写此语句呢?
procedure TForm2.Button1Click(Sender: TObject); begin if Table1fieldbyname(Edit1.Text).DataType = ftString then showmessage('ftString'); end;以下是对DataType值的描述! Value DescriptionftUnknown Unknown or undetermined ftString Character or string field ftSmallint 16-bit integer field ftInteger 32-bit integer field ftWord 16-bit unsigned integer field ftBoolean Boolean field ftFloat Floating-point numeric field ftCurrency Money field ftBCD Binary-Coded Decimal field ftDate Date field ftTime Time field ftDateTime Date and time field ftBytes Fixed number of bytes (binary storage) ftVarBytes Variable number of bytes (binary storage)ftAutoInc Auto-incrementing 32-bit integer counter field ftBlob Binary Large OBject field ftMemo Text memo field ftGraphic Bitmap field ftFmtMemo Formatted text memo field ftParadoxOle Paradox OLE field ftDBaseOle dBASE OLE field ftTypedBinary Typed binary field ftCursor Output cursor from an Oracle stored procedure (TParam only) ftFixedChar Fixed character field ftWideString Wide string field ftLargeInt Large integer field ftADT Abstract Data Type fieldftArray Array field ftReference REF field ftDataSet DataSet field ftOraBlob BLOB fields in Oracle 8 tables ftOraClob CLOB fields in Oracle 8 tables ftVariant Data of unknown or undetermined type ftInterface References to interfaces (IUnknown) ftIDispatch References to IDispatch interfaces ftGuid globally unique identifier (GUID) values
to madyak(下岗的程序员) : 用你的方法后,运行时出错,提示ftString是未定义的。 是不是要定义一下呢,如何定义呢?
begin
Edit2.Text:= Table1.fieldbyname(Edit1.Text).ClassName;
end;
比如说IF Table1.fieldbyname(Edit1.Text)=XX THEN
如何写此语句呢?
begin
if Table1fieldbyname(Edit1.Text).DataType = ftString then
showmessage('ftString');
end;以下是对DataType值的描述!
Value DescriptionftUnknown Unknown or undetermined
ftString Character or string field
ftSmallint 16-bit integer field
ftInteger 32-bit integer field
ftWord 16-bit unsigned integer field
ftBoolean Boolean field
ftFloat Floating-point numeric field
ftCurrency Money field
ftBCD Binary-Coded Decimal field
ftDate Date field
ftTime Time field
ftDateTime Date and time field
ftBytes Fixed number of bytes (binary storage)
ftVarBytes Variable number of bytes (binary storage)ftAutoInc Auto-incrementing 32-bit integer counter field
ftBlob Binary Large OBject field
ftMemo Text memo field
ftGraphic Bitmap field
ftFmtMemo Formatted text memo field
ftParadoxOle Paradox OLE field
ftDBaseOle dBASE OLE field
ftTypedBinary Typed binary field
ftCursor Output cursor from an Oracle stored procedure (TParam only)
ftFixedChar Fixed character field
ftWideString Wide string field
ftLargeInt Large integer field
ftADT Abstract Data Type fieldftArray Array field
ftReference REF field
ftDataSet DataSet field
ftOraBlob BLOB fields in Oracle 8 tables
ftOraClob CLOB fields in Oracle 8 tables
ftVariant Data of unknown or undetermined type
ftInterface References to interfaces (IUnknown)
ftIDispatch References to IDispatch interfaces
ftGuid globally unique identifier (GUID) values
用你的方法后,运行时出错,提示ftString是未定义的。
是不是要定义一下呢,如何定义呢?
‘姓名’字段用的是文本类型。在EDIT1中输入‘姓名’后,
Table1fieldbyname(Edit1.Text).DataType = ftString 的值还是为假,
这是什么原因,文本类型应该的对应哪一种FT?
结贴。看来我这个问题还挺典型的,感谢madyak(下岗的程序员),wrsy(wuren) , RobinHZ(熊掌) 。
建议版主将此列为精华贴。