With cxgrid traversal modify data, is to use ado of eof, and cxGrid1DBTableView1 DataController. IsEOF, cxGrid1DBTableView1. Controller. FocusedRow. IsLast to determine whether or not to take, but crossing the line, please you see greatly
Procedure TfrmBatchExtend. SbtnExtendClick (Sender: TObject); Var RowIndex: Integer; Q: TADOQuery; SDate, sName, s: a string; F: TIniFile; The begin If (eExtend. Text='0') or (eExtend. Text=' ') then The begin ShowMessage (' delay in for at least 1 month); The Exit; end;
Q:=TADOQuery. Create (Self); Q.C onnectionString:='Provider=SQLOLEDB. 1; Password='+ b_sPassword +'; Persist Security Info=True; User ID=sa; Initial Catalog=APark; Data Source='+ b_sDBServer; Q.S QL. Text:='select * from T1_Operator where mID=' + sName + '; Q.O pen; SName:=q.F ieldByName (' Name '). AsString; Q.C lose; Q.S QL. Text:=' ';
With qryBatch do The begin If the not Active then The Open; RowIndex:=0; First; While not Eof do The begin If cxGrid1DBTableView1. The codebehind (categories.aspx.cs). Records [rowIndex] Values [0]=null then The Exit; If cxGrid1DBTableView1. The codebehind (categories.aspx.cs). Records [rowIndex] Values [0]='1' then The begin Edit; //t3 table modify the period of validity, t4 table insert a record If FieldByName (' Expiry.) AsString="' then FieldByName (' Expiry). AsDateTime:=Now;
If (cxGrid1DBTableView1. The codebehind (categories.aspx.cs). Records [rowIndex] Values [0]='0') or (cxGrid1DBTableView1. The codebehind (categories.aspx.cs). Records [rowIndex] Values [0]='1') then Next;
Inc (rowIndex);
If cxGrid1DBTableView1. DataController. IsEOF then The Exit;
If cxGrid1DBTableView1. Controller. FocusedRow. IsLast then The Exit; end; Edit; UpdateBatch (arAll); Q.D estroy; end; end;
CodePudding user response:
If (cxGrid1DBTableView1. The codebehind (categories.aspx.cs). Records [rowIndex] Values [0]='0') or (cxGrid1DBTableView1. The codebehind (categories.aspx.cs). Records [rowIndex] Values [0]='1') then Next;
Inc (rowIndex);
Every time is not necessarily performed qrybatch. Next; But rowindex + 1 at a time, in the QRY. EOF=TRUE, rowindex will cross!!!!!