Locate Error(50分)

  • 主题发起人 主题发起人 自我教育
  • 开始时间 开始时间

自我教育

Unregistered / Unconfirmed
GUEST, unregistred user!
Query.SQL.Add('select * from table1 union all select * from table2');
open;
Query.Locate('Name',value,[]);//定位到table2中的记录
提示错误,无法定位合集
但是定位到table1中的记录就无错误提示
并且两个表的结构完全相同
为什么?
如何解决?
 
你的表结构相同,如果你的TABLE1和TABEL2有相同的记录的话,SELECT结果集中将有
两条一模一样的记录,系统就不知道定位到哪一条了/
 
如仅仅是定位记录,而不修改TABLE2的表,在 open 下面加上
Query.FetchAll;
[:D]我没试过[:D]
 
我试了,无论定位到哪条记录都没问题呀

procedure TForm1.Button1Click(Sender: TObject);
begin
Query1.Close;
Query1.SQL.Text := 'select * from table1 union select * from table2';
Query1.Open;
Query1.Locate('name','corp3',[]);
end;
 
楼上的不是吧?我怎么不可以呢!另外,我要修改记录怎么办呢?
 
//Query1的RequestLive属性要=True;

Query1.Edit;
Query1.FieldByName('aaa'). AsString:='bbbb';
Query1.Post;
 
后退
顶部