用ADO可以用Join的连结表更新记录啦 (100分)

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

me_x

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.bPostClick(Sender: TObject); //更新记录
var p: ^boolean;
begin
p := @(MQuery.FieldByName('CompanyName').ReadOnly);
p^ := True;
MQuery.Post;
p^ := False;
MQuery.UpdateBatch;
end;
procedure TForm1.MQueryAfterOpen(DataSet: TDataSet);
begin
MQuery.Properties['Unique Table'].Value := 'Orders';
MQuery.Properties['Resync Command'].Value :=
'Select * From (Select OrderID, Orders.CustomerID, CompanyName
+ ' From Orders, Customers '
+ ' Where Orders.CustomerID = Customers.CustomerID'
+ ' and OrderID between 11000 and 11011) a'
+ ' Where a.OrderID = ?';
MQuery.Properties['Update Resync'].Value := adResyncAll;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
MQuery.SQL.Text := 'Select OrderID, Orders.CustomerID, CompanyName'
+ ' from Orders, Customers'
+ ' where Orders.CustomerID = Customers.CustomerID'
+ ' and OrderID between 11000 and 11011';
end;

initialization
CoInitialize(Nil);

finalization
CoUnInitialize;
只能在Delphi5下通过
 
看得头都大了。级联更新好向没这么麻烦,我做的时候都只是在数据库图表里设置一下级联
更新就行了。
 
不过,程序思想还是挺可以的哦!
 
me_x,你可以在缓冲下完成更新吗??
而且对JOIN的表进行了操作,而且JOIN的表不要进行更新!!!

WISEINFO@163.COM
 
后退
顶部