類似這樣......begin CQ_JB_P_F:=TCQ_JB_P_F.Create(Self); if CQ_JB_P_F.ShowModal=mrok then begin cxGrid2.BeginUpdate; cxGrid2DBTableView1.BeginUpdate; for iLoop:=0 to cxGrid2DBTableView1.DataController.GetSelectedCount -1 do begin cxGrid2DBTableView1.Controller.FocusedRow:=cxGrid2DBTableView1.Controller.SelectedRows[iLoop]; adoq_JB.Edit; adoq_JB.FieldByName('JBRQ').AsString:=FormatDateTime('yyyy/mm/dd',DT); adoq_JB.FieldByName('SJKSSJ').AsString:=FormatDateTime('hh:mm:ss',DtKSSJ); adoq_JB.FieldByName('SJJSSJ').AsString:=FormatDateTime('hh:mm:ss',DtJSSJ); adoq_JB.FieldByName('SJJBSS').AsString:=FormatDateTime('hh:mm:ss',FlGZSS); adoq_JB.FieldByName('JBYY').AsString:=StrJBYY; adoq_JB.FieldByName('JBDD').AsString:=StrID; adoq_JB.FieldByName('STATUS').AsString:=StrJBLX; adoq_JB.Post; end; cxGrid2DBTableView1.EndUpdate; cxGrid2.EndUpdate; end;
Self.DoubleBuffered := True;
CQ_JB_P_F:=TCQ_JB_P_F.Create(Self);
if CQ_JB_P_F.ShowModal=mrok then
begin
cxGrid2.BeginUpdate;
cxGrid2DBTableView1.BeginUpdate;
for iLoop:=0 to cxGrid2DBTableView1.DataController.GetSelectedCount -1 do
begin
cxGrid2DBTableView1.Controller.FocusedRow:=cxGrid2DBTableView1.Controller.SelectedRows[iLoop];
adoq_JB.Edit;
adoq_JB.FieldByName('JBRQ').AsString:=FormatDateTime('yyyy/mm/dd',DT);
adoq_JB.FieldByName('SJKSSJ').AsString:=FormatDateTime('hh:mm:ss',DtKSSJ);
adoq_JB.FieldByName('SJJSSJ').AsString:=FormatDateTime('hh:mm:ss',DtJSSJ);
adoq_JB.FieldByName('SJJBSS').AsString:=FormatDateTime('hh:mm:ss',FlGZSS);
adoq_JB.FieldByName('JBYY').AsString:=StrJBYY;
adoq_JB.FieldByName('JBDD').AsString:=StrID;
adoq_JB.FieldByName('STATUS').AsString:=StrJBLX;
adoq_JB.Post;
end;
cxGrid2DBTableView1.EndUpdate;
cxGrid2.EndUpdate;
end;
Self.BeginUpdate;
//Do Something
Self.EndUpdate;