W
wisdomphg
Unregistered / Unconfirmed
GUEST, unregistred user!
从degrid1选一个或多个记录,添加到degrid2中,degrid1中选中的数据要删除去,这个数据在degrid2中不刷新就能显示,以下是富翁朋友给的我不知道代码问题出在那,运行dbgrid1--->dbgrid2会报错.属性:query1 query2dbgrid1. dbgrid2ClientDataSet1 ClientDataSet2 DataSetProvider1datasource1.dataset :=ClientDataSet1;dbgrid1.datasource := datasource1;datasource2.dataset :=ClientDataSet2;dbgrid2.datasource := datasource2;--------------------DBGrid1取数据代码query1.close;query1.sql.text:=_____________;query1.open;DataSetProvider1.DataSet:=query1;ClientDataSet1.close;ClientDataSet1.Data:= DataSetProvider1.Data;--------------------------------------------------dbgrid1-->dbgrid2代码:var I:Integer;begin if ClientDataSet1.RecordCount<=0 then exit; ClientDataSet2.Append; For i:=0 to ClientDataSet1.Fields.Count-1 do ClientDataSet2.Fields.Value:=ClientDataSet1.Fields.Value; ClientDataSet2.Post; ClientDataSet1.Delete;end;