如何确定TQuery对象中字段所属的表(50分)

  • 主题发起人 主题发起人 meki
  • 开始时间 开始时间
M

meki

Unregistered / Unconfirmed
GUEST, unregistred user!
当TQuery对象的SQL语句从几个表关联如SELECT A.FIELD1,B.FIELD2 FROM A,B时
如何取得TField所属的表?
 
Indicates the name of the field in its original database table.

property Origin: String;

Description

Origin is only assigned at design time by the Fields editor, and only when the field component is used by a TQuery object. The Origin property distinguishes the name of the field as it appears in its dataset from the name of the field in the base table on which it is based. For example, in a query that uses the following SQL statement, the value of Origin is CUSTOMER.CUSTNO.

SELECT CUSTNO AS ID FROM CUSTOMER

In this case, the FieldName property is ID.
 
[blue]我的意思时多表关联时如何确定TField所属的表。
多表关联时Origin属性好像是空值。[/blue]
 
>>多表关联时Origin属性好像是空值
你用的不是TQuery吧,是Ado控件吗?
Origin只对Bde连接才可以用!如果用TQuery,多表关连是可以的。
对Ado数据集不支持,是空值。
没办法就要自己分析Sql语句了。
(也是前两天才知道,拿那50分心中一直感到愧疚!)
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部