private void loopThroughProc() { int errorCode = 0; string errorMsg = ""; var dao = new DocumentProcDAO(); //startIndex = 0; int noOfFetches = 0; int totRec = 1000; while (true) { noOfFetches++; this.log.Debug("Doing fetch :" + noOfFetches + " : " + totRec); this.resultTable = dao.GetDocuments(this.startIndex, out this.totalDoc, out errorCode, out errorMsg); if (errorCode != 0 || this.totalDoc == 0) { MessageBox.Show("No Documents found :" + errorMsg); return; } this.resultBindingSource.DataSource = this.resultTable; totRec += this.resultBindingSource.Count; this.resultBindingSource.MoveLast(); DataRowView view = (DataRowView)this.resultBindingSource.Current; this.startIndex = Utilities.GetIntegerValue(view.Row.ItemArray[0]); } }